From c9ddb90aae441cf071d19e47a66019d194d3cdf0 Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Tue, 25 Nov 2025 20:55:46 +0530 Subject: [PATCH] SimpleChatTCRV:MarkDown:Headings, Pre initial cleanup Remove markdown heading markers Fix pre equivalent blocks of markdown given that they can have the block type following ``` marker Remember to add line break at end of line wrt pre block. --- tools/server/public_simplechat/typemd.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/server/public_simplechat/typemd.mjs b/tools/server/public_simplechat/typemd.mjs index a1d3eab57e..fe67b9e7f8 100644 --- a/tools/server/public_simplechat/typemd.mjs +++ b/tools/server/public_simplechat/typemd.mjs @@ -27,18 +27,19 @@ export class MarkDown { this.in.pre = false this.html += "\n" } else { - this.html += line + this.html += `${line}\n` } return } if (line.startsWith ("#")) { let hLevel = lineA[0].length - this.html += `${lineRStripped}\n` + this.html += `${line.slice(hLevel)}\n` return } - if (lineA[0] == '```') { + let matchPre = line.match(/^```([a-zA-Z0-9]*)(.*)/); + if ( matchPre != null) { this.in.pre = true - this.html += "
\n"
+            this.html += `
\n`
             return
         }
         this.html += `

${line}

`