From bc1ab20cdfc1ef19f59e360c04990e0a089e4af3 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Fri, 10 Jan 2020 15:35:41 -0600 Subject: [PATCH] turns out this has frightening state --- utils/utils.go | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index e2bbdf709..0183731c6 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -11,26 +11,6 @@ import ( "github.com/kballard/go-shellquote" ) -var mdCompiler md.Compiler - -func init() { - mdCompiler = md.Compiler{ - Columns: 100, - SyntaxHighlighter: md.SyntaxTheme{ - "keyword": md.Style{Color: "#9196ed"}, - "comment": md.Style{ - Color: "#c0c0c2", - }, - "literal": md.Style{ - Color: "#aaedf7", - }, - "name": md.Style{ - Color: "#fe8eb5", - }, - }, - } -} - func OpenInBrowser(url string) error { browser := os.Getenv("BROWSER") if browser == "" { @@ -86,6 +66,21 @@ func normalizeNewlines(d []byte) []byte { func RenderMarkdown(text string) string { textB := []byte(text) textB = normalizeNewlines(textB) + mdCompiler := md.Compiler{ + Columns: 100, + SyntaxHighlighter: md.SyntaxTheme{ + "keyword": md.Style{Color: "#9196ed"}, + "comment": md.Style{ + Color: "#c0c0c2", + }, + "literal": md.Style{ + Color: "#aaedf7", + }, + "name": md.Style{ + Color: "#fe8eb5", + }, + }, + } return mdCompiler.Compile(string(textB)) }