From bdf85a7e08e92942187b92d3c1cd4f3e6d434b62 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 28 Oct 2026 09:51:59 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20principles=20round=204:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20an=20item's?= =?UTF-8?q?=20line=20names=20the=20missing=20=20before=20the=20next?= =?UTF-8?q?=20item=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/html/parse/html-to-adf.test.ts | 2 ++ src/html/parse/html-to-adf.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/html/parse/html-to-adf.test.ts b/src/html/parse/html-to-adf.test.ts index 7030c7d..4f4038b 100644 --- a/src/html/parse/html-to-adf.test.ts +++ b/src/html/parse/html-to-adf.test.ts @@ -290,6 +290,8 @@ const messages: readonly (readonly [string, string])[] = [ ['\n', ' holds its attributes as name="value", each value escaped as text is, then >: found "&b=2\\">x\\n\\n"'], ['\n', 'an item\'s line ends at , or at a line feed before the item\'s next block: found "x\\n"…'], ['\n', 'an item\'s line ends at , or at a line feed before the item\'s next block: found "\n
  • a
  • b
  • \n\n', 'an item\'s line ends at , or at a line feed before the item\'s next block: found "
  • b
  • \\n\\n"'], + ['\n', 'an item\'s line ends at , or at a line feed before the item\'s next block: found "
  • b
  • \\n\\n"'], ['

    x

    \n', ' as written here is no mark element of the dialect, and a mark element holds text, or one other mark element around text: found "x

    \\n"'], ['


    x

    \n', '
    as written here is no mark element of the dialect, and a mark element holds text, or one other mark element around text: found "
    x

    \\n"'], ['

    \n', 'a mark element holds text, or one other mark element around text: found "

    \\n"'], diff --git a/src/html/parse/html-to-adf.ts b/src/html/parse/html-to-adf.ts index 08e02b8..2b891b4 100644 --- a/src/html/parse/html-to-adf.ts +++ b/src/html/parse/html-to-adf.ts @@ -252,8 +252,8 @@ function readItemLine(html: string, index: number, open: Open): Result', end) && !html.startsWith('\n', end)) { const lineEnd = "an item's line ends at , or at a line feed before the item's next block" - // After a line's `

    `, or before a block, no inline element can stand. - const stop = line.value.form === 'bare' && !isBlockStart(html, end) ? misread(html, end, `${lineEnd}, and its text spells < as <`, 'no inline element of the dialect') : { at: end, message: `${lineEnd}: ${foundAt(html, end)}` } + // After a line's `

    `, or before a block or the next item, no inline element can stand. + const stop = line.value.form === 'bare' && !isBlockStart(html, end) && startTagName(html, end) !== 'li' ? misread(html, end, `${lineEnd}, and its text spells < as <`, 'no inline element of the dialect') : { at: end, message: `${lineEnd}: ${foundAt(html, end)}` } return refused('unmappable-html', stop.message, html, stop.at, open.place) } const paragraph = asFirstParagraph({ end, node }, line.value.form, html, index, place)