Пример #1
0
// post's preview html,
// use "<!--more-->" to separate, return first part
func (p *Post) PreviewHTML() template.HTML {
	bytes := bytes.Split(p.Raw, []byte("<!--more-->"))[0]
	if p.rawType == "markdown" {
		return template.HTML(helper.Markdown(bytes))
	}
	return template.HTML(bytes)
}
Пример #2
0
// post's content html
func (p *Post) ContentHTML() template.HTML {
	if p.rawType == "markdown" {
		return template.HTML(helper.Markdown(p.Raw))
	}
	return template.HTML(p.Raw)
}