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:
Eric Drechsel 2016-06-19 14:32:07 -07:00
parent 1587a8a05b
commit 6321f9b951
1 changed files with 1 additions and 2 deletions

View File

@ -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 := ""