SimpleChatTCRV:Markdown: Ordered Ya Unordered
Start ordered or unordered list as the case may be and push the same into endType for matching unwinding. Ignore empty lines and dont force a list unwind.
This commit is contained in:
parent
2788752880
commit
b4be1cb4b8
|
|
@ -70,8 +70,13 @@ export class MarkDown {
|
||||||
if (lastOffset < curOffset){
|
if (lastOffset < curOffset){
|
||||||
this.in.list.offsets.push(curOffset)
|
this.in.list.offsets.push(curOffset)
|
||||||
listLvl = this.in.list.offsets.length
|
listLvl = this.in.list.offsets.length
|
||||||
this.html += "<ul>\n"
|
if (matchUnOrdered[2][matchUnOrdered[2].length-1] == '.') {
|
||||||
this.in.list.endType.push("</ul>\n")
|
this.html += "<ol>\n"
|
||||||
|
this.in.list.endType.push("</ol>\n")
|
||||||
|
} else {
|
||||||
|
this.html += "<ul>\n"
|
||||||
|
this.in.list.endType.push("</ul>\n")
|
||||||
|
}
|
||||||
} else if (lastOffset > curOffset){
|
} else if (lastOffset > curOffset){
|
||||||
while (this.in.list.offsets[this.in.list.offsets.length-1] > curOffset) {
|
while (this.in.list.offsets[this.in.list.offsets.length-1] > curOffset) {
|
||||||
this.in.list.offsets.pop()
|
this.in.list.offsets.pop()
|
||||||
|
|
@ -192,7 +197,9 @@ export class MarkDown {
|
||||||
if (this.process_list_unordered(line)) {
|
if (this.process_list_unordered(line)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.unwind_list()
|
if (line.trim().length > 0) {
|
||||||
|
this.unwind_list()
|
||||||
|
}
|
||||||
this.html += `<p>${line}</p>`
|
this.html += `<p>${line}</p>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue