@@ -258,7 +258,7 @@ function deltaToMdast(delta) {
258258 // Handle newlines within text content
259259 if ( text . includes ( "\n" ) && text !== "\n" ) {
260260 const lines = text . split ( "\n" ) ;
261-
261+
262262 // Process all lines except the last one as complete lines
263263 for ( let i = 0 ; i < lines . length - 1 ; i ++ ) {
264264 const line = lines [ i ] ;
@@ -271,13 +271,13 @@ function deltaToMdast(delta) {
271271 currentParagraph . children . push ( ...nodes ) ;
272272 textBuffer = line ;
273273 }
274-
274+
275275 // Process line break with empty attributes (regular paragraph break)
276276 processLineBreak ( mdast , currentParagraph , { } , textBuffer , currentList ) ;
277277 currentParagraph = null ;
278278 textBuffer = "" ;
279279 }
280-
280+
281281 // Add the last line to the buffer without processing the line break yet
282282 const lastLine = lines [ lines . length - 1 ] ;
283283 if ( lastLine . length > 0 ) {
@@ -288,7 +288,7 @@ function deltaToMdast(delta) {
288288 currentParagraph . children . push ( ...nodes ) ;
289289 textBuffer = lastLine ;
290290 }
291-
291+
292292 continue ;
293293 }
294294
@@ -298,9 +298,9 @@ function deltaToMdast(delta) {
298298 currentParagraph ,
299299 attributes ,
300300 textBuffer ,
301- currentList
301+ currentList ,
302302 ) ;
303-
303+
304304 // Reset paragraph and buffer after processing line break
305305 currentParagraph = null ;
306306 textBuffer = "" ;
@@ -436,22 +436,27 @@ function processLineBreak(
436436 if ( attributes . header ) {
437437 processHeaderLineBreak ( mdast , textBuffer , attributes ) ;
438438 return null ;
439- }
440-
439+ }
440+
441441 if ( attributes [ "code-block" ] ) {
442442 processCodeBlockLineBreak ( mdast , textBuffer , attributes ) ;
443443 return currentList ;
444- }
445-
444+ }
445+
446446 if ( attributes . list ) {
447- return processListLineBreak ( mdast , currentParagraph , attributes , currentList ) ;
448- }
449-
447+ return processListLineBreak (
448+ mdast ,
449+ currentParagraph ,
450+ attributes ,
451+ currentList ,
452+ ) ;
453+ }
454+
450455 if ( attributes . blockquote ) {
451456 processBlockquoteLineBreak ( mdast , currentParagraph ) ;
452457 return currentList ;
453- }
454-
458+ }
459+
455460 // Default case: regular paragraph
456461 mdast . children . push ( currentParagraph ) ;
457462 return null ;
@@ -468,19 +473,19 @@ function handleEmptyLineWithAttributes(mdast, attributes, currentList) {
468473 if ( attributes [ "code-block" ] ) {
469474 mdast . children . push ( createEmptyCodeBlock ( attributes ) ) ;
470475 return currentList ;
471- }
472-
476+ }
477+
473478 if ( attributes . list ) {
474479 const list = ensureList ( mdast , attributes , currentList ) ;
475480 list . children . push ( createEmptyListItem ( ) ) ;
476481 return list ;
477- }
478-
482+ }
483+
479484 if ( attributes . blockquote ) {
480485 mdast . children . push ( createEmptyBlockquote ( ) ) ;
481486 return currentList ;
482487 }
483-
488+
484489 return null ;
485490}
486491
@@ -566,7 +571,7 @@ function processHeaderLineBreak(mdast, textBuffer, attributes) {
566571function processCodeBlockLineBreak ( mdast , textBuffer , attributes ) {
567572 const lang =
568573 attributes [ "code-block" ] === "plain" ? null : attributes [ "code-block" ] ;
569-
574+
570575 // Find the last code block with the same language
571576 let lastCodeBlock = null ;
572577 for ( let i = mdast . children . length - 1 ; i >= 0 ; i -- ) {
@@ -599,16 +604,20 @@ function processCodeBlockLineBreak(mdast, textBuffer, attributes) {
599604 */
600605function ensureList ( mdast , attributes , currentList ) {
601606 const isOrderedList = attributes . list === "ordered" ;
602-
607+
603608 // If there's no current list or the list type doesn't match
604609 if ( ! currentList || currentList . ordered !== isOrderedList ) {
605610 // Check if the last child is a list of the correct type
606611 const lastChild = mdast . children [ mdast . children . length - 1 ] ;
607- if ( lastChild && lastChild . type === "list" && lastChild . ordered === isOrderedList ) {
612+ if (
613+ lastChild &&
614+ lastChild . type === "list" &&
615+ lastChild . ordered === isOrderedList
616+ ) {
608617 // Use the last list if it matches the type
609618 return lastChild ;
610619 }
611-
620+
612621 // Create a new list
613622 const newList = {
614623 type : "list" ,
@@ -619,7 +628,7 @@ function ensureList(mdast, attributes, currentList) {
619628 mdast . children . push ( newList ) ;
620629 return newList ;
621630 }
622-
631+
623632 return currentList ;
624633}
625634
@@ -642,20 +651,21 @@ function processListLineBreak(
642651 // Check if this list item already exists to avoid duplication
643652 const paragraphContent = JSON . stringify ( currentParagraph . children ) ;
644653 const isDuplicate = list . children . some (
645- item => item . children ?. length === 1 &&
646- JSON . stringify ( item . children [ 0 ] . children ) === paragraphContent
654+ ( item ) =>
655+ item . children ?. length === 1 &&
656+ JSON . stringify ( item . children [ 0 ] . children ) === paragraphContent ,
647657 ) ;
648-
658+
649659 if ( ! isDuplicate ) {
650660 const listItem = {
651661 type : "listItem" ,
652662 spread : false ,
653663 children : [ currentParagraph ] ,
654664 } ;
655-
665+
656666 list . children . push ( listItem ) ;
657667 }
658-
668+
659669 return list ;
660670}
661671
@@ -669,11 +679,12 @@ function processBlockquoteLineBreak(mdast, currentParagraph) {
669679 // Look for an existing blockquote with identical content to avoid duplication
670680 const paragraphContent = JSON . stringify ( currentParagraph . children ) ;
671681 const existingBlockquote = mdast . children . find (
672- child => child . type === "blockquote" &&
673- child . children ?. length === 1 &&
674- JSON . stringify ( child . children [ 0 ] . children ) === paragraphContent
682+ ( child ) =>
683+ child . type === "blockquote" &&
684+ child . children ?. length === 1 &&
685+ JSON . stringify ( child . children [ 0 ] . children ) === paragraphContent ,
675686 ) ;
676-
687+
677688 if ( ! existingBlockquote ) {
678689 mdast . children . push ( {
679690 type : "blockquote" ,
0 commit comments