aboutsummaryrefslogtreecommitdiff
path: root/markdown
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-12-10 12:28:36 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-12-10 12:28:36 +0100
commitd56090d43c925dbbd22a3e0c3f6d541674a09697 (patch)
tree39a04525f6270c8c56e3b93bbbc205697466f850 /markdown
parent254dbd680e092e40240b7b247ddab4081c5a18ad (diff)
fix(markdown): linebreak not replaced by space when line starts with external considered as literal
Diffstat (limited to 'markdown')
-rw-r--r--markdown/ast_paragraph.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/markdown/ast_paragraph.go b/markdown/ast_paragraph.go
index 7e865c5..a6417e2 100644
--- a/markdown/ast_paragraph.go
+++ b/markdown/ast_paragraph.go
@@ -73,9 +73,13 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, *ParseError) {
lxs.Before() // because we did not use it
return tree, nil
}
- n = 0
- if lxs.Current().Value == "!" {
- tree.content = append(tree.content, astLiteral(lxs.Current().Value))
+ if lxs.Current().Value != "[" {
+ //if lxs.Current().Value == "!" {
+ s := lxs.Current().Value
+ if n > 0 {
+ s = " " + s
+ }
+ tree.content = append(tree.content, astLiteral(s))
} else {
ext, err := external(lxs)
if err != nil {
@@ -83,6 +87,7 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, *ParseError) {
}
tree.content = append(tree.content, ext)
}
+ n = 0
case lexerCode:
if len(lxs.Current().Value) > 1 {
return nil, &ParseError{lxs: *lxs, internal: ErrInvalidCodeBlockPosition}