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.
This commit is contained in:
parent
d3f1a398d8
commit
c9ddb90aae
|
|
@ -27,18 +27,19 @@ export class MarkDown {
|
||||||
this.in.pre = false
|
this.in.pre = false
|
||||||
this.html += "</pre>\n"
|
this.html += "</pre>\n"
|
||||||
} else {
|
} else {
|
||||||
this.html += line
|
this.html += `${line}\n`
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (line.startsWith ("#")) {
|
if (line.startsWith ("#")) {
|
||||||
let hLevel = lineA[0].length
|
let hLevel = lineA[0].length
|
||||||
this.html += `<h${hLevel}>${lineRStripped}</h${hLevel}>\n`
|
this.html += `<h${hLevel}>${line.slice(hLevel)}</h${hLevel}>\n`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (lineA[0] == '```') {
|
let matchPre = line.match(/^```([a-zA-Z0-9]*)(.*)/);
|
||||||
|
if ( matchPre != null) {
|
||||||
this.in.pre = true
|
this.in.pre = true
|
||||||
this.html += "<pre>\n"
|
this.html += `<pre class="${matchPre[1]}">\n`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.html += `<p>${line}</p>`
|
this.html += `<p>${line}</p>`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue