-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test KaTeX: math is by element class; fix js links
- Loading branch information
Showing
1 changed file
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,21 @@ | |
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" | ||
integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" | ||
crossorigin="anonymous"></script> | ||
<script>document.addEventListener("DOMContentLoaded", function () { | ||
var mathElements = document.getElementsByClassName("math"); | ||
var macros = []; | ||
for (var i = 0; i < mathElements.length; i++) { | ||
var texText = mathElements[i].firstChild; | ||
if (mathElements[i].tagName == "SPAN") { | ||
katex.render(texText.data, mathElements[i], { | ||
displayMode: mathElements[i].classList.contains('display'), | ||
throwOnError: false, | ||
macros: macros, | ||
fleqn: false | ||
}); | ||
}}}); | ||
</script> | ||
|
||
<!-- To automatically render math in text elements, include the auto-render extension: --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" | ||
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous" | ||
onload="renderMathInElement(document.body);"></script> | ||
</head> | ||
|
||
<body> | ||
|