How does Go interpret markdown content?

for example, is there any way for go to convert the article content of markdown grammar into html content?

May.22,2021

https://github.com/russross/b.


github.com/russross/blackfriday

func MarkdownToHtml(con string) string {
    renderer := blackfriday.HtmlRenderer(MarkdownToHtmlCommonHtmlFlags, "", "")
    unsafe := blackfriday.Markdown([]byte(con), renderer, MarkdownToHtmlCommonExtensions)
    html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)

    return string(html)
}

MarkdownToHtmlCommonHtmlFlags and MarkdownToHtmlCommonExtensions are available in the document, so you can choose which one you need.
the above can basically meet your need to transfer to html.

Menu