18 lines
325 B
Go
18 lines
325 B
Go
|
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)
|
||
|
}
|