diff options
Diffstat (limited to 'nuldoc-src/html.ts')
| -rw-r--r-- | nuldoc-src/html.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/nuldoc-src/html.ts b/nuldoc-src/html.ts index 2832490..5e573ad 100644 --- a/nuldoc-src/html.ts +++ b/nuldoc-src/html.ts @@ -160,7 +160,7 @@ function elementNodeToHtmlText(e: Element, ctx: Context): string { } } s += ">"; - if (dtd.type === "block") { + if (dtd.type === "block" && e.name !== "pre") { s += "\n"; } } @@ -171,7 +171,7 @@ function elementNodeToHtmlText(e: Element, ctx: Context): string { ctx.isInPre = true; } forEachChild(e, (c) => { - if (dtd.type === "block") { + if (dtd.type === "block" && !ctx.isInPre) { if (isInlineNode(c)) { if (needsIndent(prevChild)) { s += indent(ctx); @@ -191,11 +191,13 @@ function elementNodeToHtmlText(e: Element, ctx: Context): string { ctx.indentLevel -= 1; if (e.name !== "__root__" && !dtd.auto_closing) { - if (dtd.type === "block") { - if (needsLineBreak(prevChild)) { - s += "\n"; + if (e.name !== "pre") { + if (dtd.type === "block") { + if (needsLineBreak(prevChild)) { + s += "\n"; + } + s += indent(ctx); } - s += indent(ctx); } s += `</${e.name}>`; if (dtd.type === "block") { |
