Skip to content

Commit adfbe18

Browse files
committed
Switch to MathJax 3.x. Fixes alshedivat#115.
1 parent 2614259 commit adfbe18

File tree

8 files changed

+67
-92
lines changed

8 files changed

+67
-92
lines changed

_config.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ scholar:
146146
# -----------------------------------------------------------------------------
147147

148148
enable_google_analytics: false
149-
enable_katex: true
150149
enable_mansory: true
151-
enable_progressbar: true
150+
enable_math: true
152151
enable_tooltips: false
153152
show_social_icons: false
154153

@@ -170,11 +169,8 @@ fontawesome:
170169
jquery:
171170
version: "3.5.1"
172171
integrity: "sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g=="
173-
katex:
174-
version: "0.12.0"
175-
integrity:
176-
css: "sha512-h7nl+xz8wgDlNM4NqKEM4F1NkIRS17M9+uJwIGwuo8vGqIl4BhuCKdxjWEINm+xyrUjNCnK5dCrhM0sj+wTIXw=="
177-
js: "sha512-/CMIhXiDA3m2c9kzRyd97MTb3MC6OVnx4TElQ7fkkoRghwDf6gi41gaT1PwF270W6+J60uTmwgeRpNpJdRV6sg=="
172+
mathjax:
173+
version: "3.1.2"
178174
mansory:
179175
version: "4.2.2"
180176
integrity: "sha256-Nn1q/fx0H7SNLZMQ5Hw5JLaTRZp0yILA/FRexe19VdI="

_includes/head.html

+58
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<!-- Bootstrap & MDB -->
99
<link href="https://stackpath.bootstrapcdn.com/bootstrap/{{ site.bootstrap.version }}/css/bootstrap.min.css" rel="stylesheet" integrity="{{ site.bootstrap.integrity.css }}" crossorigin="anonymous">
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/{{ site.mdb.version }}/css/mdb.min.css" integrity="{{ site.mdb.integrity.css }}" crossorigin="anonymous" />
11+
<script defer src="https://code.jquery.com/jquery-{{ site.jquery.version }}.slim.min.js" integrity="{{ site.jquery.integrity }}" crossorigin="anonymous"></script>
12+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/{{ site.popper.version }}/umd/popper.min.js" integrity="{{ site.popper.integrity }}" crossorigin="anonymous"></script>
13+
<script defer src="https://stackpath.bootstrapcdn.com/bootstrap/{{ site.bootstrap.version }}/js/bootstrap.min.js" integrity="{{ site.bootstrap.integrity.js }}" crossorigin="anonymous"></script>
14+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/{{ site.mdb.version }}/js/mdb.min.js" integrity="{{ site.mdb.integrity.js }}" crossorigin="anonymous"></script>
1115

1216
<!-- Fonts & Icons -->
1317
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/{{ site.fontawesome.version }}/css/all.min.css" integrity="{{ site.fontawesome.integrity }}" crossorigin="anonymous">
@@ -29,3 +33,57 @@
2933
<meta property="og:description" content="{{ page.title }}" />
3034
<meta property="og:image" content="{%- if page.og_image -%}{{ page.og_image }}{%- else -%}{{ site.og_image }}{%- endif -%}" />
3135
{% endif %}
36+
37+
<!-- Load Common JS -->
38+
<script defer src="{{ '/assets/js/common.js' | relative_url }}"></script>
39+
40+
<!-- Code Syntax Highlighting -->
41+
<link rel="stylesheet" href="https://gitcdn.link/repo/jwarby/jekyll-pygments-themes/master/{{ site.highlight_theme }}.css" />
42+
43+
{% if site.enable_math %}
44+
<!-- Load MathJax -->
45+
<script defer type="text/javascript" id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@{{ site.mathjax.version }}/es5/tex-mml-chtml.js"></script>
46+
<script defer src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
47+
{% endif %}
48+
49+
{% if site.enable_mansory %}
50+
<!-- Load Mansory & imagesLoaded -->
51+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/masonry/{{ site.mansory.version }}/masonry.pkgd.min.js" integrity="{{ site.masonry.integrity }}" crossorigin="anonymous"></script>
52+
<script defer src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
53+
54+
<!-- Project Cards Layout -->
55+
<script defer type="text/javascript">
56+
// Init Masonry
57+
var $grid = $('.grid').masonry({
58+
gutter: 10,
59+
horizontalOrder: true,
60+
itemSelector: '.grid-item',
61+
});
62+
// layout Masonry after each image loads
63+
$grid.imagesLoaded().progress( function() {
64+
$grid.masonry('layout');
65+
});
66+
</script>
67+
{% endif %}
68+
69+
{% if site.enable_tooltips %}
70+
<!-- Enable Tooltips -->
71+
<script defer type="text/javascript">
72+
$(function () {
73+
$('[data-toggle="tooltip"]').tooltip()
74+
})
75+
</script>
76+
{% endif %}
77+
78+
{% if site.enable_google_analytics %}
79+
<!-- Google Analytics -->
80+
<script defer>
81+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
82+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
83+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
84+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
85+
86+
ga('create', '{{ site.google_analytics }}', 'auto');
87+
ga('send', 'pageview');
88+
</script>
89+
{% endif %}

_includes/hemline.html

-60
This file was deleted.

_layouts/default.html

-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@
2323

2424
</body>
2525

26-
{% include hemline.html %}
27-
2826
</html>

_layouts/distill.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</head>
1313

1414
<d-front-matter>
15-
<script type="text/json">{
15+
<script async type="text/json">{
1616
"title": "{{ page.title }}",
1717
"description": "{{ page.description }}",
1818
"published": "{{ page.date }}",
@@ -81,8 +81,6 @@ <h1>{{ page.title }}</h1>
8181

8282
</body>
8383

84-
{% include hemline.html %}
85-
8684
<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}">
8785
</d-bibliography>
8886

_posts/2015-10-20-math.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ title: a post with math
44
date: 2015-10-20 11:12:00-0400
55
description: an example of a blog post with some math
66
---
7-
This theme supports rendering beautiful math in inline and display modes using [KaTeX](https://khan.github.io/KaTeX/) engine. You just need to surround your math expression with `$$`, like `$$ E = mc^2 $$`. If you leave it inside a paragraph, it will produce an inline expression, just like $$ E = mc^2 $$.
7+
This theme supports rendering beautiful math in inline and display modes using [MathJax 3](https://www.mathjax.org/){:target="\_blank"} engine. You just need to surround your math expression with `$$`, like `$$ E = mc^2 $$`. If you leave it inside a paragraph, it will produce an inline expression, just like $$ E = mc^2 $$.
88

99
To use display mode, again surround your expression with `$$` and place it as a separate paragraph. Here is an example:
1010

1111
$$
1212
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
1313
$$
1414

15-
Note that [KaTeX](https://khan.github.io/KaTeX/) is work in progress, so it does not support the full range of math expressions as, say, [MathJax](https://www.mathjax.org/). Yet, it is [blazing fast](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
15+
Note that MathJax 3 is [a major re-write of MathJax](https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html){:target="\_blank"} that brought a significant improvement to the loading and rendering speed, which is now [on par with KaTeX](http://www.intmath.com/cg5/katex-mathjax-comparison.php){:target="\_blank"}.

_posts/2018-12-22-distill.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ _styles: >
4242

4343
## Equations
4444

45-
This theme supports rendering beautiful math in inline and display modes using [KaTeX](https://khan.github.io/KaTeX/) engine.
45+
This theme supports rendering beautiful math in inline and display modes using [MathJax 3](https://www.mathjax.org/){:target="\_blank"} engine.
4646
You just need to surround your math expression with `$$`, like `$$ E = mc^2 $$`.
4747
If you leave it inside a paragraph, it will produce an inline expression, just like $$ E = mc^2 $$.
4848

@@ -53,8 +53,8 @@ $$
5353
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
5454
$$
5555

56-
Note that [KaTeX](https://khan.github.io/KaTeX/) is work in progress, so it does not support the full range of math expressions as, say, [MathJax](https://www.mathjax.org/).
57-
Yet, it is [blazing fast](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
56+
Note that MathJax 3 is [a major re-write of MathJax](https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html){:target="\_blank"} that brought a significant improvement to the loading and rendering speed, which is now [on par with KaTeX](http://www.intmath.com/cg5/katex-mathjax-comparison.php){:target="\_blank"}.
57+
5858

5959
***
6060

assets/js/katex.js

-15
This file was deleted.

0 commit comments

Comments
 (0)