Skip to content

Commit e3a2858

Browse files
committed
fix(math): Requires page.math for Mathjax. Add integrity checks
1 parent dd7002e commit e3a2858

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

_includes/foot/mathjax.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
<script defer src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
2-
<script async id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
1+
<script defer
2+
src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0"
3+
integrity="sha384-3d4jRKquKl90C9aFG+eH4lPJmtbPHgACWHrp+VomFOxF8lzx2jxqeYkhpRg18UWC"
4+
crossorigin="anonymous">
5+
</script>
6+
{%- if page.math -%}
7+
<script async
8+
id="MathJax-script"
9+
src="https://cdn.jsdelivr.net/npm/mathjax@4.1.0/tex-mml-chtml.js"
10+
integrity="sha384-pTCnJ6SV7q3Uxsux1a1dYA7psHUmFQB178t6FtIE16r5QY5EibXwxLy9KRzBqM1w"
11+
crossorigin="anonymous">
12+
</script>
13+
{%- endif %}

content/_session/parts/formatting.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
[GitHub Markdown] syntax are supported including extras such as [Markdown Math].
55

6+
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
7+
8+
Requires:
9+
10+
```
11+
---
12+
math: true
13+
---
14+
```
15+
16+
617
### Supported Header Tags
718
Header tags from `h1` to `h6` are supported.
819
Though `<h1>` is the largest, it is recommended that you should start with `<h2>` for main general headings.

content/_session/session-03.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
math: true
23
---
34

45
{% include_relative parts/formatting.md %}

0 commit comments

Comments
 (0)