forked from tangled.org/core
this repo has no description
1package pages 2 3import ( 4 "bytes" 5 6 "github.com/yuin/goldmark" 7 "github.com/yuin/goldmark/extension" 8 "github.com/yuin/goldmark/parser" 9) 10 11func renderMarkdown(source string) string { 12 md := goldmark.New( 13 goldmark.WithExtensions(extension.GFM), 14 goldmark.WithParserOptions( 15 parser.WithAutoHeadingID(), 16 ), 17 ) 18 var buf bytes.Buffer 19 if err := md.Convert([]byte(source), &buf); err != nil { 20 return source 21 } 22 return buf.String() 23}