diff --git a/tools/server/public_simplechat/typemd.mjs b/tools/server/public_simplechat/typemd.mjs index a3740bcaea..ca448b8fb8 100644 --- a/tools/server/public_simplechat/typemd.mjs +++ b/tools/server/public_simplechat/typemd.mjs @@ -1,5 +1,5 @@ //@ts-check -// Helpers to handle markdown content +// simple minded helpers to handle markdown content // by Humans for All // @@ -17,13 +17,23 @@ export class MarkDown { this.html = "" } + unwind_list_unordered() { + for(const i in this.in.listUnordered) { + this.html += "\n" + } + this.in.listUnordered.length = 0 + } + + unwind_list() { + this.unwind_list_unordered() + } + /** * Process a line from markdown content * @param {string} line */ process_line(line) { let lineA = line.split(' ') - let lineRStripped = line.trimStart() if (this.in.pre) { if (lineA[0] == '```') { this.in.pre = false @@ -33,13 +43,20 @@ export class MarkDown { } return } + if (line == '---') { + this.unwind_list() + this.html += "
\n`
return
@@ -77,6 +94,7 @@ export class MarkDown {
}
return
}
+ this.unwind_list()
this.html += `${line}
`
}