修复markd解析器

master
yutent 2023-03-24 11:07:20 +08:00
parent 183beac037
commit b59ee76ab5
1 changed files with 18 additions and 11 deletions

View File

@ -303,6 +303,8 @@ class Tool {
for (let it of this.list) {
// 非空行
if (it) {
emptyLineLength = 0
if (~it.indexOf('<table>') || ~it.indexOf('</table>')) {
html += it
isTable = !isTable
@ -527,7 +529,7 @@ class Tool {
// 引用结束
if (isBlockquote) {
isBlockquote = false
if (emptyLineLength > 0) {
if (emptyLineLength > 1) {
emptyLineLength = 0
while (blockquoteLevel > 0) {
blockquoteLevel--
@ -538,23 +540,28 @@ class Tool {
}
if (isList) {
while (orderListLevel > -1 || unorderListLevel > -1) {
if (orderListLevel > unorderListLevel) {
html += '</ol>'
orderListLevel--
} else {
html += '</ul>'
unorderListLevel--
if (emptyLineLength > 1) {
while (orderListLevel > -1 || unorderListLevel > -1) {
if (orderListLevel > unorderListLevel) {
html += '</ol>'
orderListLevel--
} else {
html += '</ul>'
unorderListLevel--
}
}
isList = false
emptyLineLength = 0
}
isList = false
continue
}
//
if (isParagraph) {
isParagraph = false
html += '</p>'
if (emptyLineLength > 1) {
isParagraph = false
html += '</p>'
}
}
}
}