fix(quotes): fix unexpected multiple quotes joins

pull/694/head
Moises P. Sena 2022-03-29 14:14:30 -03:00
parent 4c9bf95126
commit f976c2179d
2 changed files with 35 additions and 4 deletions

View File

@ -987,7 +987,13 @@ func (p *Markdown) quote(data []byte) int {
end++
}
if end < len(data) && data[end] == '\n' {
end++
if end+1 < len(data) && data[end+1] == '\n' {
beg += p.quotePrefix(data[beg:])
raw.Write(data[beg:end])
break
} else {
end++
}
}
if pre := p.quotePrefix(data[beg:]); pre > 0 {
// skip the prefix
@ -1166,9 +1172,9 @@ func (p *Markdown) listTypeChanged(data []byte, flags *ListType) bool {
func endsWithBlankLine(block *Node) bool {
// TODO: figure this out. Always false now.
for block != nil {
//if block.lastLineBlank {
//return true
//}
// if block.lastLineBlank {
// return true
// }
t := block.Type
if t == List || t == Item {
block = block.LastChild

View File

@ -1215,6 +1215,31 @@ continues
<p>woo.</p>
</blockquote>
`,
// -------------------------------------------
cat("> foo",
"> ",
"> quote",
"",
"> foo2",
"> ",
"> quote2",
"",
"continues",
""),
`<blockquote>
<p>foo</p>
<p>quote</p>
</blockquote>
<blockquote>
<p>foo2</p>
<p>quote2</p>
</blockquote>
<p>continues</p>
`,
}