22 lines
457 B
Go
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
|
|
}
|