Skip to content

Commit 973177e

Browse files
add math support with katex (#573)
1 parent 2abba21 commit 973177e

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

_includes/javascript.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,19 @@
1212
ga('create', 'UA-37305346-2', 'auto');
1313
ga('send', 'pageview');
1414
</script>
15+
{% if page.math %}
16+
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>
17+
<script>
18+
options={
19+
delimiters: [
20+
{left: "$$", right: "$$", display: true},
21+
{left: "$", right: "$", display: false},
22+
{left: "\\(", right: "\\)", display: false},
23+
{left: "\\[", right: "\\]", display: true}
24+
],
25+
output: "mathml"
26+
}
27+
</script>
28+
<script src="{{ relative_root_path }}/assets/js/katex-auto-render.min.js" onload="renderMathInElement(document.body, options)"></script>
29+
{% endif %}
30+

_layouts/base.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/bootstrap-theme.css" />
1717
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/lesson.css" />
1818
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/syntax.css" />
19+
{% if page.math %}
20+
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/katex.min.css" />
21+
{% endif %}
1922
<link rel="license" href="#license-info" />
2023

2124
{% include favicons.html %}

0 commit comments

Comments
 (0)