3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 06:35:44 +01:00

Answer prose round 1: the comments and test name say what ends a list, the README says because, the changelog leads with the rename and gives the definition's trigger, and items 56 and 98 state their claims plainly

This commit is contained in:
2026-10-10 11:21:18 +02:00
committed by Lillem4n
parent 419bb10324
commit cea9137495
5 changed files with 28 additions and 27 deletions
+2 -2
View File
@@ -248,7 +248,7 @@ function openContainer(walk: Walk, start: ContainerStart): void {
walk.stack.push({ blocks, indentation: start.indentation, kind: 'item', list })
}
// An item opening after its list's last item closed, as an empty item a blank line ends does, continues that list.
// An empty item closes at the blank line after it, yet the next item continues its list unless endList ended it.
function openedList(walk: Walk, start: Extract<ContainerStart, { kind: 'item' }>): ListBlock {
if (!start.fresh) return start.list
const blocks = currentBlocks(walk)
@@ -258,7 +258,7 @@ function openedList(walk: Walk, start: Extract<ContainerStart, { kind: 'item' }>
return start.list
}
// A paragraph of link reference definitions alone leaves no block, yet ends the list before it as any block does.
// A paragraph holding only link reference definitions leaves no block, yet ends the list before it as any block does.
function endList(walk: Walk): void {
const previous = currentBlocks(walk).at(-1)
if (isList(previous)) walk.endedLists.add(previous)
+1 -1
View File
@@ -676,7 +676,7 @@ test('reads a bullet list, the marker width setting the continuation', () => {
assert.deepEqual(content(losslessMarkdownToAdf('-\n\n Part.\n')), [bulletList(item()), paragraph('Part.')])
})
test('reads two lists a link reference definition parts as two lists, in every reader', () => {
test('ends a list at a link reference definition, in every reader', () => {
for (const read of [commonMarkToAdf, losslessMarkdownToAdf, portableMarkdownToAdf]) {
assert.deepEqual(content(read('- a\n\n[r]: /u\n\n- b\n')), [bulletList(item(paragraph('a'))), bulletList(item(paragraph('b')))])
assert.deepEqual(content(read('- a\n\n[r]: /u\n- b\n')), [bulletList(item(paragraph('a'))), bulletList(item(paragraph('b')))])