personal-website/libs/markdown.go

18 lines
325 B
Go
Raw Normal View History

2023-06-06 22:49:26 +00:00
package libs
import (
"github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday/v2"
)
type MarkdownLib struct {
}
func (ml *MarkdownLib) Render(s []byte) string {
output := blackfriday.Run(s)
_ = output
html := bluemonday.UGCPolicy().SanitizeBytes(output)
// println(string(html))
return string(html)
}