Blackfriday可以实现Markdown 转html
文档
https://github.com/russross/blackfriday
安装
bash
go get github.com/russross/blackfriday
代码示例
go
package main
import (
"fmt"
"os"
"github.com/russross/blackfriday"
)
func main() {
input, _ := os.ReadFile("index.md")
output := blackfriday.MarkdownBasic(input)
fmt.Print(string(output))
}
输入 index.md
md
# title
content
输出
html
<h1>title</h1>
<p>content</p>