mirror of https://gitee.com/answerdev/answer.git
fix(markdown): Try to add extensions in markdown parser
This commit is contained in:
parent
15777fccbc
commit
98810da807
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue