This commit is contained in:
parent
db248328b9
commit
6d21dcb293
10
main.go
10
main.go
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user