From 6321f9b951ff56a6d63ba63fff562688b4abb8cd Mon Sep 17 00:00:00 2001 From: Eric Drechsel Date: Sun, 19 Jun 2016 14:32:07 -0700 Subject: [PATCH] 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 --- website/camweb.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/camweb.go b/website/camweb.go index 0963952df..5357dd4fd 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -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 := ""