From 98810da8073f4d72c7e302a247fe683339c3fb2a Mon Sep 17 00:00:00 2001 From: LinkinStar Date: Fri, 23 Dec 2022 13:12:07 +0800 Subject: [PATCH] fix(markdown): Try to add extensions in markdown parser --- pkg/converter/markdown.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/converter/markdown.go b/pkg/converter/markdown.go index 79ebead6..a4d9e908 100644 --- a/pkg/converter/markdown.go +++ b/pkg/converter/markdown.go @@ -2,10 +2,13 @@ package converter import ( "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/parser" ) // Markdown2HTML convert markdown to html func Markdown2HTML(md string) string { - html := markdown.ToHTML([]byte(md), nil, nil) + extensions := parser.HardLineBreak | parser.CommonExtensions + p := parser.NewWithExtensions(extensions) + html := markdown.ToHTML([]byte(md), p, nil) return string(html) }