Skip to content

Commit

Permalink
add math support with katex (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan authored Apr 27, 2021
1 parent 2abba21 commit 973177e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,19 @@
ga('create', 'UA-37305346-2', 'auto');
ga('send', 'pageview');
</script>
{% if page.math %}
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>
<script>
options={
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false},
{left: "\\(", right: "\\)", display: false},
{left: "\\[", right: "\\]", display: true}
],
output: "mathml"
}
</script>
<script src="{{ relative_root_path }}/assets/js/katex-auto-render.min.js" onload="renderMathInElement(document.body, options)"></script>
{% endif %}

3 changes: 3 additions & 0 deletions _layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/lesson.css" />
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/syntax.css" />
{% if page.math %}
<link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/katex.min.css" />
{% endif %}
<link rel="license" href="#license-info" />

{% include favicons.html %}
Expand Down
Loading

0 comments on commit 973177e

Please sign in to comment.