7

【笔记】Go语言将Markdown转换为HTML

 1 year ago
source link: https://loli.fj.cn/2023/06/20/Go%E8%AF%AD%E8%A8%80%E5%B0%86Markdown%E8%BD%AC%E6%8D%A2%E4%B8%BAHTML/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】Go语言将Markdown转换为HTML

2023-06-20

Go语言将Markdown转换为HTML

go get github.com/russross/blackfriday
import (
"github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday"
)

Markdown转换HTML

<markdown>:Markdown文档内容

imput := []byte("<markdown>")
unsafe := blackfriday.MarkdownCommon(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)

哔哩哔哩——地鼠文档


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK