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

Answer stability round 2: 1 🔴, 0 🟡 (0 misread); a block inside a carried code block shows as a paragraph again

This commit is contained in:
2026-10-24 01:38:00 +02:00
committed by Lillem4n
parent fd5b2fb86c
commit 94efd30c59
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -30,11 +30,11 @@ export function carryElement(tag: string, json: string, content: string): string
function shownBlocks(root: AdfNode, codeLineFeed: string): ShownBlock[] {
const shown: ShownBlock[] = []
let current: ShownBlock = { code: undefined, html: '' }
// Each entry holds the code block it stands in; a `null` node ends a block, after which the content stands in `code` again.
// Each entry holds the code block it stands in, none where another block stands between them; a `null` node ends a block, after which the content stands in `code` again.
const pending: { code: AdfNode | undefined; node: AdfNode | null }[] = [{ code: undefined, node: root }]
for (let next = pending.pop(); next !== undefined; next = pending.pop()) {
const { node } = next
const code = node?.type === 'codeBlock' ? node : next.code
const code = node?.type === 'codeBlock' ? node : node !== null && partsShownText(node.type) ? undefined : next.code
if (node === null || partsShownText(node.type)) {
if (current.html !== '') shown.push(current)
current = { code, html: '' }