package libs import ( "html/template" "strings" "github.com/microcosm-cc/bluemonday" "github.com/russross/blackfriday/v2" ) type MarkdownLib struct { } func (ml *MarkdownLib) Render(md []byte, supressParagraph bool) template.HTML { output := blackfriday.Run(md) if supressParagraph { output = []byte(strings.ReplaceAll(string(output), "

", "")) output = []byte(strings.ReplaceAll(string(output), "

", "")) } _ = output html := bluemonday.UGCPolicy().SanitizeBytes(output) // println(string(html)) kek := template.HTML(html) return kek } // func (ml MarkdownLib) MarkDowner(args ...interface{}) template.HTML { // s := blackfriday.MarkdownCommon([]byte(fmt.Sprintf("%s", args...))) // return template.HTML(s) // }