diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-01 09:43:06 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-01 09:43:06 +0200 |
| commit | c49daa8fe6fdcf1c7fab08ee32f1ff994979c401 (patch) | |
| tree | 6ac743ddd35563893f92f2fcba73907657d36191 /mardown/ast_paragraph.go | |
| parent | b07dd267fc10812f7e94bf6d9be08667537dd331 (diff) | |
fix(markdown): paragraph parse always skip one char
Diffstat (limited to 'mardown/ast_paragraph.go')
| -rw-r--r-- | mardown/ast_paragraph.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mardown/ast_paragraph.go b/mardown/ast_paragraph.go index e9855a7..d728183 100644 --- a/mardown/ast_paragraph.go +++ b/mardown/ast_paragraph.go @@ -43,7 +43,13 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, error) { switch lxs.Current().Type { case lexerBreak: n++ - case lexerLiteral, lexerHeader, lexerQuote: + case lexerQuote: + if n > 0 { + lxs.Before() + return tree, nil + } + tree.content = append(tree.content, astLiteral(lxs.Current().Value)) + case lexerLiteral, lexerHeader: n = 0 tree.content = append(tree.content, astLiteral(lxs.Current().Value)) case lexerModifier: @@ -68,6 +74,9 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, error) { return tree, nil } } + if !lxs.Finished() { + lxs.Before() // because we never handle the last item + } return tree, nil } |
