20 lines
393 B
Go
20 lines
393 B
Go
|
package html
|
||
|
|
||
|
import (
|
||
|
"html/template"
|
||
|
"strings"
|
||
|
|
||
|
"github.com/russross/blackfriday/v2"
|
||
|
)
|
||
|
|
||
|
func Parse(templates ...string) *template.Template {
|
||
|
return template.Must(template.New("ALL").Funcs(FuncMap()).ParseFiles(templates...))
|
||
|
}
|
||
|
|
||
|
func FuncMap() template.FuncMap {
|
||
|
return template.FuncMap{
|
||
|
"lowercase": strings.ToLower,
|
||
|
"uppercase": strings.ToUpper,
|
||
|
"markdown": blackfriday.Run,
|
||
|
}
|
||
|
}
|