@@ -693,6 +693,56 @@ describe('parseIncompleteMarkdown', () => {
693693 } ) ;
694694 } ) ;
695695
696+ describe ( 'list handling' , ( ) => {
697+ it ( 'should not add asterisk to lists using asterisk markers' , ( ) => {
698+ const text = '* Item 1\n* Item 2\n* Item 3' ;
699+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
700+ } ) ;
701+
702+ it ( 'should not add asterisk to single list item' , ( ) => {
703+ const text = '* Single item' ;
704+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
705+ } ) ;
706+
707+ it ( 'should not add asterisk to nested lists' , ( ) => {
708+ const text = '* Parent item\n * Nested item 1\n * Nested item 2' ;
709+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
710+ } ) ;
711+
712+ it ( 'should handle lists with italic text correctly' , ( ) => {
713+ const text = '* Item with *italic* text\n* Another item' ;
714+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
715+ } ) ;
716+
717+ it ( 'should complete incomplete italic even in list items' , ( ) => {
718+ // List markers are not counted, but incomplete italic formatting is still completed
719+ const text = '* Item with *incomplete italic\n* Another item' ;
720+ // The function adds an asterisk to complete the italic, though at the end of text
721+ // This is not ideal but matches current behavior
722+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( '* Item with *incomplete italic\n* Another item*' ) ;
723+ } ) ;
724+
725+ it ( 'should handle mixed list markers and italic formatting' , ( ) => {
726+ const text = '* First item\n* Second *italic* item\n* Third item' ;
727+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
728+ } ) ;
729+
730+ it ( 'should handle lists with tabs for indentation' , ( ) => {
731+ const text = '*\tItem with tab\n*\tAnother item' ;
732+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
733+ } ) ;
734+
735+ it ( 'should not interfere with dash lists' , ( ) => {
736+ const text = '- Item 1\n- Item 2 with *italic*\n- Item 3' ;
737+ expect ( parseIncompleteMarkdown ( text ) ) . toBe ( text ) ;
738+ } ) ;
739+
740+ it ( 'should handle the Gemini response example from issue' , ( ) => {
741+ const geminiResponse = '* user123\n* user456\n* user789' ;
742+ expect ( parseIncompleteMarkdown ( geminiResponse ) ) . toBe ( geminiResponse ) ;
743+ } ) ;
744+ } ) ;
745+
696746 describe ( 'edge cases' , ( ) => {
697747 it ( 'should handle text ending with formatting characters' , ( ) => {
698748 expect ( parseIncompleteMarkdown ( 'Text ending with *' ) ) . toBe (
0 commit comments