diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-06 00:20:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-06 00:20:40 +0900 |
| commit | d8c7e198e4338be30a33909666083154056eedba (patch) | |
| tree | 0c1c70f3f6d90dec91f9808506f14b732a451ff0 /vhosts/blog/nuldoc-src | |
| parent | bcca40d0e7a9ddf0a487cb2b0c9819f332ac73f2 (diff) | |
| download | nsfisis.dev-d8c7e198e4338be30a33909666083154056eedba.tar.gz nsfisis.dev-d8c7e198e4338be30a33909666083154056eedba.tar.zst nsfisis.dev-d8c7e198e4338be30a33909666083154056eedba.zip | |
feat(blog/nuldoc): fix processing of tight list
Diffstat (limited to 'vhosts/blog/nuldoc-src')
| -rw-r--r-- | vhosts/blog/nuldoc-src/djot/to_html.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/vhosts/blog/nuldoc-src/djot/to_html.ts b/vhosts/blog/nuldoc-src/djot/to_html.ts index f31408da..3c95c14b 100644 --- a/vhosts/blog/nuldoc-src/djot/to_html.ts +++ b/vhosts/blog/nuldoc-src/djot/to_html.ts @@ -283,14 +283,15 @@ function removeUnnecessaryParagraphNode(doc: Document) { if (child.kind !== "element" || child.name !== "li") { continue; } - if (child.children.length !== 1) { - continue; - } - const grandChild = child.children[0]; - if (grandChild.kind !== "element" || grandChild.name !== "p") { - continue; + const newGrandChildren: Node[] = []; + for (const grandChild of child.children) { + if (grandChild.kind === "element" && grandChild.name === "p") { + newGrandChildren.push(...grandChild.children); + } else { + newGrandChildren.push(grandChild); + } } - child.children = grandChild.children; + child.children = newGrandChildren; } }); } |
