mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Works
Former-commit-id: 512f2d3da4804173fe57742e0a50105b6daa9b6a [formerly cb018be7957dea25f4e5636a6c86f6344bb21223] [formerly 8e9ef6e466dc6ea6c300583a944a2223721c08cc [formerly 4bb4f501e75a83dab88c9520bec89b8d0b61bc37 [formerly63982d402d
]]] Former-commit-id: 1491644778252a8edc2a7056d9cfb997d412cd8d [formerly 808628c9d571e2960fce0e5064d237c23336d9df] Former-commit-id: d54ab5932876063015895ed2a57f9e598ac7d27b Former-commit-id:3cf2ef8b12
This commit is contained in:
parent
4051e51430
commit
0ed6df503e
10
routes.go
10
routes.go
@ -4,6 +4,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -62,9 +63,16 @@ func renderMarkdown(c *gin.Context, title string) {
|
|||||||
}
|
}
|
||||||
unsafe := blackfriday.MarkdownCommon([]byte(p.Text))
|
unsafe := blackfriday.MarkdownCommon([]byte(p.Text))
|
||||||
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
|
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
|
||||||
|
html2 := string(html)
|
||||||
|
|
||||||
|
r, _ := regexp.Compile("\\$(.*?)\\$")
|
||||||
|
for _, s := range r.FindAllString(html2, -1) {
|
||||||
|
html2 = strings.Replace(html2, s, "<div class='tex' data-expr='"+s[1:len(s)-1]+"'></div>", 1)
|
||||||
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "view.tmpl", gin.H{
|
c.HTML(http.StatusOK, "view.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
"Body": template.HTML(html),
|
"Body": template.HTML([]byte(html2)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
static/css/fonts/KaTeX_AMS-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_AMS-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_AMS-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_AMS-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_AMS-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_AMS-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_AMS-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_AMS-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.eot
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Bold.eot
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Bold.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Bold.woff
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Bold.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Bold.eot
Normal file
BIN
static/css/fonts/KaTeX_Main-Bold.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Bold.ttf
Normal file
BIN
static/css/fonts/KaTeX_Main-Bold.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Bold.woff
Normal file
BIN
static/css/fonts/KaTeX_Main-Bold.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Bold.woff2
Normal file
BIN
static/css/fonts/KaTeX_Main-Bold.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Italic.eot
Normal file
BIN
static/css/fonts/KaTeX_Main-Italic.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Italic.ttf
Normal file
BIN
static/css/fonts/KaTeX_Main-Italic.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Italic.woff
Normal file
BIN
static/css/fonts/KaTeX_Main-Italic.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Italic.woff2
Normal file
BIN
static/css/fonts/KaTeX_Main-Italic.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Main-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Main-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Main-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Main-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Main-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-BoldItalic.eot
Normal file
BIN
static/css/fonts/KaTeX_Math-BoldItalic.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
BIN
static/css/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-BoldItalic.woff
Normal file
BIN
static/css/fonts/KaTeX_Math-BoldItalic.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
BIN
static/css/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Italic.eot
Normal file
BIN
static/css/fonts/KaTeX_Math-Italic.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Italic.ttf
Normal file
BIN
static/css/fonts/KaTeX_Math-Italic.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Italic.woff
Normal file
BIN
static/css/fonts/KaTeX_Math-Italic.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Italic.woff2
Normal file
BIN
static/css/fonts/KaTeX_Math-Italic.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Math-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Math-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Math-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Math-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Math-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Bold.eot
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Bold.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Bold.woff
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Bold.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Italic.eot
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Italic.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Italic.woff
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Italic.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Script-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Script-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Script-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Script-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Script-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Script-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Script-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Script-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size1-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Size1-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size1-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Size1-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size1-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Size1-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size1-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Size1-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size2-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Size2-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size2-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Size2-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size2-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Size2-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size2-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Size2-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size3-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Size3-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size3-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Size3-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size3-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Size3-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size3-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Size3-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size4-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Size4-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size4-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Size4-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size4-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Size4-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Size4-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Size4-Regular.woff2
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Typewriter-Regular.eot
Normal file
BIN
static/css/fonts/KaTeX_Typewriter-Regular.eot
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
BIN
static/css/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Typewriter-Regular.woff
Normal file
BIN
static/css/fonts/KaTeX_Typewriter-Regular.woff
Normal file
Binary file not shown.
BIN
static/css/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
BIN
static/css/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
Binary file not shown.
@ -7,7 +7,8 @@
|
|||||||
{{ template "header" }}
|
{{ template "header" }}
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/view.css">
|
<link rel="stylesheet" type="text/css" href="/static/css/view.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/static/css/katex.min.css">
|
||||||
|
<script src="/static/js/katex.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@ -42,6 +43,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( document ).ready(function() {
|
||||||
|
var tex = document.getElementsByClassName("tex");
|
||||||
|
Array.prototype.forEach.call(tex, function(el) {
|
||||||
|
katex.render(el.getAttribute("data-expr"), el);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user