mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 11:24:13 +00:00
Bring all MathJax logic into one common template
Might as well do this right away, we're here anyway.
This commit is contained in:
parent
a82882fddc
commit
a659acdc14
4 changed files with 33 additions and 43 deletions
|
@ -30,21 +30,11 @@
|
|||
{{range .Images}}<meta property="og:image" content="{{.}}" />{{else}}<meta property="og:image" content="{{.Collection.AvatarURL}}">{{end}}
|
||||
<meta property="article:published_time" content="{{.Created8601}}">
|
||||
{{if .Collection.StyleSheet}}<style type="text/css">{{.Collection.StyleSheetDisplay}}</style>{{end}}
|
||||
{{if .Collection.RenderMathJax}}
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||
processEscapes: true
|
||||
},
|
||||
"HTML-CSS": { fonts: ["TeX"] }
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>{{end}}
|
||||
|
||||
{{if .Collection.RenderMathJax}}
|
||||
<!-- Add mathjax logic -->
|
||||
{{template "mathjax" . }}
|
||||
{{end}}
|
||||
|
||||
<!-- Add highlighting logic -->
|
||||
{{template "highlighting" .}}
|
||||
|
|
|
@ -30,20 +30,11 @@
|
|||
<meta property="og:url" content="{{.CanonicalURL}}tag:{{.Tag}}" />
|
||||
<meta property="og:image" content="{{.Collection.AvatarURL}}">
|
||||
{{if .Collection.StyleSheet}}<style type="text/css">{{.Collection.StyleSheetDisplay}}</style>{{end}}
|
||||
|
||||
{{if .Collection.RenderMathJax}}
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||
processEscapes: true
|
||||
},
|
||||
"HTML-CSS": { fonts: ["TeX"] }
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>{{end}}
|
||||
<!-- Add mathjax logic -->
|
||||
{{template "mathjax" .}}
|
||||
{{end}}
|
||||
|
||||
<!-- Add highlighting logic -->
|
||||
{{template "highlighting" . }}
|
||||
|
|
|
@ -27,22 +27,12 @@
|
|||
<meta property="og:url" content="{{.CanonicalURL}}" />
|
||||
<meta property="og:description" content="{{.Description}}" />
|
||||
<meta property="og:image" content="{{.AvatarURL}}">
|
||||
{{if .StyleSheet}}<style type="text/css">{{.StyleSheetDisplay}}</style>{{end}}
|
||||
{{if .RenderMathJax}}
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||
processEscapes: true
|
||||
},
|
||||
"HTML-CSS": { fonts: ["TeX"] }
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>{{end}}
|
||||
{{if .StyleSheet}}<style type="text/css">{{.StyleSheetDisplay}}</style>{{end}}
|
||||
|
||||
{{if .RenderMathJax}}
|
||||
<!-- Add mathjax logic -->
|
||||
{{template "mathjax" .}}
|
||||
{{end}}
|
||||
|
||||
<!-- Add highlighting logic -->
|
||||
{{template "highlighting" . }}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
{{define "highlighting"}}
|
||||
<!-- TODO: make this conditional on presence of code blocks -->
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/atom-one-light.min.css"/>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript"
|
||||
src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js" async></script>
|
||||
|
||||
<script>
|
||||
addEventListener('load', function () {
|
||||
|
@ -12,3 +13,21 @@
|
|||
}});
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
<!-- Include mathjax configuration -->
|
||||
{{define "mathjax"}}
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js"],
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||
processEscapes: true
|
||||
},
|
||||
"HTML-CSS": { fonts: ["TeX"] }
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
|
||||
{{end}}
|
||||
|
|
Loading…
Reference in a new issue