@abraca/convert 2.19.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/markdown-to-yjs.ts
CHANGED
|
@@ -588,10 +588,14 @@ function parseBlocks(markdown: string): Block[] {
|
|
|
588
588
|
continue
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
// Blockquote
|
|
592
|
-
|
|
591
|
+
// Blockquote. Match any line that opens with `>` (CommonMark allows the
|
|
592
|
+
// space after the marker to be omitted, e.g. `>50 comments`). The paragraph
|
|
593
|
+
// collector below treats EVERY `>`-leading line as a block start, so this
|
|
594
|
+
// branch must claim all of them — otherwise a `>x` line matches no branch
|
|
595
|
+
// and the loop spins without advancing `i` (silent infinite hang).
|
|
596
|
+
if (line.startsWith('>')) {
|
|
593
597
|
const bqLines: string[] = []
|
|
594
|
-
while (i < lines.length &&
|
|
598
|
+
while (i < lines.length && lines[i]!.startsWith('>')) {
|
|
595
599
|
bqLines.push(lines[i]!.replace(/^>\s?/, ''))
|
|
596
600
|
i++
|
|
597
601
|
}
|
|
@@ -811,6 +815,13 @@ function parseBlocks(markdown: string): Block[] {
|
|
|
811
815
|
}
|
|
812
816
|
if (paraLines.length) {
|
|
813
817
|
blocks.push({ type: 'paragraph', text: paraLines.join(' ') })
|
|
818
|
+
} else {
|
|
819
|
+
// No branch claimed this line and the paragraph collector rejected it too
|
|
820
|
+
// (its guard excludes block-marker leads like `>`). Without forcing
|
|
821
|
+
// progress here `i` never advances and parseBlocks hangs forever. Emit the
|
|
822
|
+
// stray line as a paragraph so it survives the round-trip, and step past it.
|
|
823
|
+
blocks.push({ type: 'paragraph', text: line })
|
|
824
|
+
i++
|
|
814
825
|
}
|
|
815
826
|
}
|
|
816
827
|
|