From c49daa8fe6fdcf1c7fab08ee32f1ff994979c401 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Wed, 1 Oct 2025 09:43:06 +0200 Subject: fix(markdown): paragraph parse always skip one char --- mardown/ast_paragraph.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mardown/ast_paragraph.go') 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 } -- cgit v1.2.3