From 7e119c965bf934f63fcb19f7b322f4abd6caf2c8 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 7 Feb 2016 13:49:46 -0500 Subject: [PATCH] Math works now Former-commit-id: eceee055a867137f932b404d34eaa12670f26972 [formerly eaa2c146681562f6b5a8a4da0a7696ee5bb02294] [formerly e6c95dc13d732fc40969aca8a107cbed95e5420b [formerly ccccad5945a1cae98b8774b3a12c05b521a4fb33 [formerly 26ad3b91f07a111adc57dd2d1e9a25fe4a27dda2]]] Former-commit-id: 44b243264528f5c76abd6b841daa3e55449814a0 [formerly bd2a75d4d50f86baee9f891bbf918de090c5831c] Former-commit-id: f7b97e61be109c7cbf55bcf93eef6a4e683e5c5d Former-commit-id: 9102ca2d951ae0bc62b3abeb4804fc5463a75b3f --- routes.go | 4 ++-- templates/view.tmpl | 4 ++-- utils.go | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/routes.go b/routes.go index f57ee92..9f1d4b5 100644 --- a/routes.go +++ b/routes.go @@ -67,11 +67,11 @@ func renderMarkdown(c *gin.Context, title string) { 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) + 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 7ccefe7..255b598 100644 --- a/templates/view.tmpl +++ b/templates/view.tmpl @@ -47,12 +47,12 @@ $( document ).ready(function() { var texi = document.getElementsByClassName("texi"); Array.prototype.forEach.call(texi, function(el) { - katex.render(el.getAttribute("data-expr"), el, { displayMode: true }); + katex.render(el.getAttribute("data-expr"), el, { displayMode: false }); }); var texp = document.getElementsByClassName("texp"); Array.prototype.forEach.call(texp, function(el) { - katex.render(el.getAttribute("data-expr"), el, { displayMode: false }); + katex.render(el.getAttribute("data-expr"), el, { displayMode: true }); }); }); diff --git a/utils.go b/utils.go index ce7436c..99cdbce 100644 --- a/utils.go +++ b/utils.go @@ -23,6 +23,8 @@ You can also write your notes in [Markdown](https://daringfireball.net/projects/ If you are writing a list and you want to tick off things really easily, just add ` + "`" + `/list` + "`" + `. For example, after editing [` + "`" + `/grocery` + "`" + `](/grocery), goto [` + "`" + `/grocery/list` + "`" + `](/grocery/list). In this page, whatever you click on will be striked through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it. +Math is supported using [Katex](https://github.com/Khan/KaTeX). Simple + Be cautious about writing sensitive information in the notes as anyone with the URL has access to it. For more information, or if you'd like to edit the code, [use the github](https://github.com/schollz/cowyo).