mark2web/helper/template_filters.go
Sebastian Frank cb55dcd42b
Some checks failed
continuous-integration/drone/push Build is failing
cleaned spew output
2019-02-28 15:40:06 +01:00

22 lines
457 B
Go

package helper
import (
"github.com/flosch/pongo2"
_ "github.com/flosch/pongo2-addons"
)
func init() {
pongo2.ReplaceFilter("markdown", MarkdownFilter)
}
// MarkdownFilter is a pongo2 filter, which converts markdown to html
func MarkdownFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
return pongo2.AsSafeValue(
string(
renderMarkdown(
[]byte(in.String()),
currentPathConfig.Markdown,
))),
nil
}