diff --git a/src/markd/index.js b/src/markd/index.js index 74be18c..4244507 100644 --- a/src/markd/index.js +++ b/src/markd/index.js @@ -303,6 +303,8 @@ class Tool { for (let it of this.list) { // 非空行 if (it) { + emptyLineLength = 0 + if (~it.indexOf('') || ~it.indexOf('
')) { 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 += '' - orderListLevel-- - } else { - html += '' - unorderListLevel-- + if (emptyLineLength > 1) { + while (orderListLevel > -1 || unorderListLevel > -1) { + if (orderListLevel > unorderListLevel) { + html += '' + orderListLevel-- + } else { + html += '' + unorderListLevel-- + } } + isList = false + emptyLineLength = 0 } - isList = false continue } // if (isParagraph) { - isParagraph = false - html += '

' + if (emptyLineLength > 1) { + isParagraph = false + html += '

' + } } } }