Esempio n. 1
0
// 将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
}
Esempio n. 2
0
// (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
}