-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkatex.html
28 lines (26 loc) · 1.25 KB
/
katex.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
let to_do = [];
for (let e of document.getElementsByTagName("code")) {
if (e.parentElement.className === "language-math") {
to_do.push(function () {
let x = document.createElement('p');
katex.render(e.innerText, x, {displayMode: true, throwOnError: false});
e.parentNode.parentNode.replaceChild(x, e.parentNode);
});
}
}
for (let f of to_do) f();
renderMathInElement(document.body, {
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\(", right: "\\)", display: false},
{left: "$", right: "$", display: false},
{left: "\\[", right: "\\]", display: true}
]
});
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" crossorigin="anonymous">