示例#1
0
文件: markdown.go 项目: fxgcj/website
// 将markdown文本转换为html
func Trans2html(markdown []byte) (html []byte) {
	renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")
	outputOpts := blackfriday.Options{
		Extensions: extensions,
	}
	// Render the markdown file into HTML and return a new []Byte
	html = blackfriday.MarkdownOptions(markdown, renderer, outputOpts)
	return
}
示例#2
0
文件: blog.go 项目: ckeyer/goblog
// (b *Blog)Decode2html ...
func (b *Blog) decode2html(bs []byte) (err error) {
	renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")
	outputOpts := blackfriday.Options{
		Extensions: extensions,
	}
	// Render the markdown file into HTML and return a new []Byte
	b.Content = blackfriday.MarkdownOptions(bs,
		renderer,
		outputOpts,
	)
	return nil
}