fix(markdown): Try to add extensions in markdown parser

This commit is contained in:
LinkinStar 2022-12-23 13:12:07 +08:00
parent 15777fccbc
commit 98810da807
1 changed files with 4 additions and 1 deletions

View File

@ -2,10 +2,13 @@ package converter
import ( import (
"github.com/gomarkdown/markdown" "github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/parser"
) )
// Markdown2HTML convert markdown to html // Markdown2HTML convert markdown to html
func Markdown2HTML(md string) string { 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) return string(html)
} }