3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 07:32:58 +01:00

Answer prose round 1: a task item keeps the task lists right after its paragraphs nested, and the README, changelog, decision, comment, item 49 and a test title say it plainly

This commit is contained in:
2026-10-09 13:27:40 +02:00
committed by Lillem4n
parent 0c56a479bb
commit cd6cb8bece
9 changed files with 32 additions and 28 deletions
@@ -304,17 +304,17 @@ function reduceTaskList(node: AdfNode, reduction: Reduction): Result<AdfNode[]>
continue
}
if (isTask(child)) {
nestIn(tasks, nested)
pushMerged(tasks, nested)
nested = []
}
for (const block of blocks) (isTask(child) ? tasks : nested).push(block)
}
nestIn(tasks, nested)
pushMerged(tasks, nested)
if (regular) return success(splitTaskList({ content: tasks, type: 'taskList' }))
return success(listOf(nodeContent(tasksAsText({ content: tasks, type: 'taskList' })), 'bulletList'))
}
function nestIn(tasks: AdfNode[], nested: readonly AdfNode[]): void {
function pushMerged(tasks: AdfNode[], nested: readonly AdfNode[]): void {
for (const block of mergedLists(nested)) tasks.push(block)
}