Skip to content

Commit 86c34c1

Browse files
authored
Merge pull request #510 from cmbuckley/mathjax4
MathJax 4
2 parents 12c2522 + f0fe2a3 commit 86c34c1

9 files changed

Lines changed: 26 additions & 9 deletions

File tree

_cf/security-headers/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ const csp = {
2828
],
2929
'font-src': [
3030
'https://fonts.gstatic.com',
31-
`https://cdnjs.cloudflare.com/ajax/libs/mathjax/${dependencies.mathjax}/`,
32-
'about:', // https://github.com/mathjax/MathJax/issues/256#issuecomment-37990603
31+
'https://cdn.jsdelivr.net/npm/mathjax@4/',
3332
],
3433
'object-src': [
3534
"'self'",

_cf/security-headers/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"main": "index.js",
33
"dependencies": {
4-
"mathjax": "3.2.2"
54
}
65
}

_ci/fingerprints.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fingerprints=_data/fingerprints.yml
44

55
files=(
66
"icons:assets/img/icons/icons.svg"
7+
"maths:assets/js/maths.js"
78
"scripts:assets/js/scripts.js"
89
"search:assets/js/search.js"
910
"style:assets/css/style.css"

_data/fingerprints.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
lunr: 2.3.6
22
icons: 715715b9
3+
maths: 5414f235
34
scripts: e83760ff
45
search: b74b56ab
56
style: 01de7bae

_data/package.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

_includes/scripts.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010

1111
<script defer="defer" nonce="" src="{% include mainurl.html %}/assets/js/scripts.js{% include v.html id='scripts' %}"></script>
1212
{%- if page.maths -%}
13-
<script defer="defer" nonce="" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/{{ site.data.package.dependencies.mathjax }}/es5/tex-chtml.js"></script>
13+
<style>
14+
mjx-help { display: none !important; }
15+
.mjx-selected { outline: none !important; }
16+
</style>
17+
<script defer="defer" nonce="" src="{% include mainurl.html %}/assets/js/maths.js{% include v.html id='maths' %}"></script>
18+
<script defer="defer" nonce="" src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>
1419
{%- endif -%}
1520
{%- if page.search -%}
1621
<script defer="defer" nonce="" src="{% include mainurl.html %}/assets/js/lunr.js{% include v.html id='lunr' %}"></script>

_includes/v.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{%- unless site.suppress_fingerprints -%}
22
?v=
33

4-
{%- assign fingerprints = 'icons: 715715b9,scripts: e83760ff,search: b74b56ab,style: 01de7bae' | split: ',' -%}
4+
{%- assign fingerprints = 'icons: 715715b9,maths: 5414f235,scripts: e83760ff,search: b74b56ab,style: 01de7bae' | split: ',' -%}
55
{%- assign found = false -%}
66

77
{%- if jekyll.environment == 'production' -%}

assets/js/maths.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
window.MathJax = {
2+
options: {
3+
makeCollapsible: false,
4+
a11y: {
5+
help: false,
6+
backgroundOpacity: 0,
7+
},
8+
},
9+
startup: {
10+
ready() {
11+
const {SpeechExplorer} = MathJax._.a11y.explorer.KeyExplorer;
12+
SpeechExplorer.prototype.help = () => {};
13+
MathJax.startup.defaultReady();
14+
},
15+
},
16+
};

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"dependencies": {
3-
"mathjax": "3.2.2"
4-
},
52
"devDependencies": {
63
"netlify-plugin-html-validate": "^1.1.1",
74
"netlify-plugin-seo-lint": "cmbuckley/netlify-plugin-seo-lint#fork"

0 commit comments

Comments
 (0)