mirror of https://github.com/perkeep/perkeep.git
Instantiate markdownRenderer per-request
We were reusing markdownRenderer per-launch, which was leading to auto-generated ids incrementing on each request. See https://github.com/russross/blackfriday/pull/129 Fixes #814. Change-Id: Idb97348b076e4514cf22abe462bbdf3f8e7f6f9e
This commit is contained in:
parent
1587a8a05b
commit
6321f9b951
|
@ -392,8 +392,6 @@ const (
|
|||
blackfriday.EXTENSION_AUTO_HEADER_IDS
|
||||
)
|
||||
|
||||
var markdownRenderer = blackfriday.HtmlRenderer(markdownHTMLFlags, "", "")
|
||||
|
||||
// serveFile serves a file from disk, converting any markdown to HTML.
|
||||
func serveFile(rw http.ResponseWriter, req *http.Request, relPath, absPath string) {
|
||||
if !strings.HasSuffix(absPath, ".html") && !strings.HasSuffix(absPath, ".md") {
|
||||
|
@ -407,6 +405,7 @@ func serveFile(rw http.ResponseWriter, req *http.Request, relPath, absPath strin
|
|||
return
|
||||
}
|
||||
|
||||
var markdownRenderer = blackfriday.HtmlRenderer(markdownHTMLFlags, "", "")
|
||||
data = blackfriday.MarkdownOptions(data, markdownRenderer, blackfriday.Options{Extensions: markdownExtensions})
|
||||
|
||||
title := ""
|
||||
|
|
Loading…
Reference in New Issue