Add markdownify template filter

Note that this is a Markdownify filter, and is named as such; it's not a Asccidoc filter or in any way connected to a Page.

Fixes #524
This commit is contained in:
bep
2014-11-18 22:42:49 +01:00
committed by spf13
parent f04006978a
commit 53c707bb1d
2 changed files with 17 additions and 0 deletions

View File

@@ -96,6 +96,7 @@ func New() Template {
"isset": IsSet,
"echoParam": ReturnWhenSet,
"safeHtml": SafeHtml,
"markdownify": Markdownify,
"first": First,
"where": Where,
"highlight": Highlight,
@@ -422,6 +423,10 @@ func Highlight(in interface{}, lang string) template.HTML {
return template.HTML(helpers.Highlight(html.UnescapeString(str), lang))
}
func Markdownify(text string) template.HTML {
return template.HTML(helpers.RenderBytes([]byte(text), "markdown", ""))
}
func SafeHtml(text string) template.HTML {
return template.HTML(text)
}