mirror of
https://github.com/adulau/mastodon-markdown-archive.git
synced 2024-11-24 02:47:08 +00:00
Support escaped and non-escaped markdown conversion
This commit is contained in:
parent
b8a7f64e71
commit
4c0f5ac95d
1 changed files with 7 additions and 1 deletions
|
@ -257,10 +257,16 @@ func downloadAttachment(dir string, id string, url string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveTemplate(templateFile string) (*template.Template, error) {
|
func resolveTemplate(templateFile string) (*template.Template, error) {
|
||||||
converter := md.NewConverter("", true, nil)
|
converter := md.NewConverter("", true, &md.Options{
|
||||||
|
EscapeMode: "disabled",
|
||||||
|
})
|
||||||
|
converterEscaped := md.NewConverter("", true, &md.Options{
|
||||||
|
EscapeMode: "basic",
|
||||||
|
})
|
||||||
|
|
||||||
funcs := sprig.FuncMap()
|
funcs := sprig.FuncMap()
|
||||||
funcs["toMarkdown"] = converter.ConvertString
|
funcs["toMarkdown"] = converter.ConvertString
|
||||||
|
funcs["toMarkdownEscaped"] = converterEscaped.ConvertString
|
||||||
|
|
||||||
if templateFile == "" {
|
if templateFile == "" {
|
||||||
tmpl, err := template.New("post.tmpl").Funcs(funcs).ParseFS(templates, "templates/*.tmpl")
|
tmpl, err := template.New("post.tmpl").Funcs(funcs).ParseFS(templates, "templates/*.tmpl")
|
||||||
|
|
Loading…
Reference in a new issue