diff options
Diffstat (limited to 'markdown/ast_paragraph.go')
| -rw-r--r-- | markdown/ast_paragraph.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/markdown/ast_paragraph.go b/markdown/ast_paragraph.go index a6417e2..eddba0a 100644 --- a/markdown/ast_paragraph.go +++ b/markdown/ast_paragraph.go @@ -2,8 +2,10 @@ package markdown import ( "errors" - "fmt" "html/template" + "strings" + + "git.anhgelus.world/anhgelus/small-web/dom" ) var ( @@ -27,7 +29,9 @@ func (a *astParagraph) Eval(opt *Option) (template.HTML, *ParseError) { if a.oneLine { return content, nil } - return template.HTML(fmt.Sprintf("<p>%s</p>", trimSpace(content))), nil + return dom.NewParagraph( + template.HTML(strings.TrimSpace(string(content))), + ).Render(), nil } func paragraph(lxs *lexers, oneLine bool) (*astParagraph, *ParseError) { @@ -49,7 +53,7 @@ func paragraph(lxs *lexers, oneLine bool) (*astParagraph, *ParseError) { return tree, nil } tree.content = append(tree.content, astLiteral(lxs.Current().Value)) - case lexerLiteral, lexerHeader: + case lexerLiteral, lexerHeading: s := lxs.Current().Value // replace line break by space if n > 0 && len(tree.content) != 0 { |
