From 6d21dcb293b966a5fd06a35918ac2def591cb80e Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Mon, 18 Feb 2019 18:11:13 +0100 Subject: [PATCH] fixed blackfriday options --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 80ea7ba..d39349a 100644 --- a/main.go +++ b/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)