fixed blackfriday options
All checks were successful
the build was successful

This commit is contained in:
Sebastian Frank 2019-02-18 18:11:13 +01:00
parent db248328b9
commit 6d21dcb293
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3

10
main.go
View File

@ -435,21 +435,23 @@ RewriteRule ^$ %{REQUEST_URI}`+goToFixed+`/ [R,L]
outFile := conf.OutputPath + "/" + outputFilename
log.Debugf("using '%s' as output file", outFile)
var option blackfriday.Option
var options []blackfriday.Option
synH := conf.Config.Markdown.SyntaxHighlight
if synH != nil && *synH {
option = blackfriday.WithRenderer(bfchroma.NewRenderer())
options = []blackfriday.Option{
blackfriday.WithRenderer(bfchroma.NewRenderer()),
}
}
html := blackfriday.Run(input, option)
html := blackfriday.Run(input, options...)
// use --- for splitting document in markdown parts
regex := regexp.MustCompile("\\r?\\n\\r?---\\r?\\n\\r?")
inputParts := regex.Split(string(input), -1)
htmlParts := make([]*pongo2.Value, 0)
for _, iPart := range inputParts {
htmlParts = append(htmlParts, pongo2.AsSafeValue(string(blackfriday.Run([]byte(iPart), option))))
htmlParts = append(htmlParts, pongo2.AsSafeValue(string(blackfriday.Run([]byte(iPart), options...))))
}
log.Debugf("rendering template '%s' for '%s'", *newConfig.Template, outFile)