From 3433556629221ee58f2c1f8254327a5dbbd2ae0f Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 7 Feb 2016 13:38:39 -0500 Subject: [PATCH] Added inline math --- routes.go | 8 ++++++-- templates/view.tmpl | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/routes.go b/routes.go index a752bac..f57ee92 100644 --- a/routes.go +++ b/routes.go @@ -65,9 +65,13 @@ func renderMarkdown(c *gin.Context, title string) { html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) html2 := string(html) - r, _ := regexp.Compile("\\$(.*?)\\$") + r, _ := regexp.Compile("\\$\\$(.*?)\\$\\$") for _, s := range r.FindAllString(html2, -1) { - html2 = strings.Replace(html2, s, "
", 1) + html2 = strings.Replace(html2, s, "
", 1) + } + r, _ = regexp.Compile("\\$(.*?)\\$") + for _, s := range r.FindAllString(html2, -1) { + html2 = strings.Replace(html2, s, "
", 1) } c.HTML(http.StatusOK, "view.tmpl", gin.H{ diff --git a/templates/view.tmpl b/templates/view.tmpl index ec58ce5..7ccefe7 100644 --- a/templates/view.tmpl +++ b/templates/view.tmpl @@ -45,9 +45,14 @@