-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
121 additions
and
39 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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% assign math = page.math | default: layout.math | default: site.math %} | ||
|
||
{% case math %} | ||
{% when "katex" %} | ||
{% include katex.html %} | ||
{% endcase %} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Copied from https://katex.org/docs/browser.html#starter-template --> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-Juol1FqnotbkyZUT5Z7gUPjQ9gzlwCENvUZTpQBAPxtusdwFLRy382PSDx5UUJ4/" crossorigin="anonymous"> | ||
|
||
<!-- The loading of KaTeX is deferred to speed up page rendering --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-97gW6UIJxnlKemYavrqDHSX3SiygeOwIZhwyOKRfSaf0JWKRVj9hLASHgFTzT+0O" crossorigin="anonymous"> | ||
</script> | ||
|
||
<!-- Automatically display code inside script tags with type=math/tex using KaTeX --> | ||
<script defer src="/just-the-docs-tests/assets/js/mathtex-script-type.js"> | ||
</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, { | ||
globalGroup: true, | ||
trust: true, | ||
strict: false, | ||
throwOnError: false, | ||
});"></script> | ||
|
||
<!-- The KaTeX default is 1.21em, see https://katex.org/docs/font.html#font-size-and-lengths --> | ||
<style> | ||
.katex { | ||
font-size: 1em; | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: default | ||
math: katex | ||
--- | ||
<div style="display: none"> | ||
\( | ||
<!-- optional definitions using \newcommand, etc. (assuming globalGroup: true) | ||
see https://katex.org/docs/supported.html#macros --> | ||
\) | ||
</div> | ||
|
||
{{ content }} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Mostly copied from https://github.com/KaTeX/KaTeX/tree/main/contrib/mathtex-script-type | ||
// Options for global command definitions added by @pdmosses | ||
|
||
// import katex from "katex"; | ||
|
||
const macros = {}; | ||
|
||
let scripts = document.body.getElementsByTagName("script"); | ||
scripts = Array.prototype.slice.call(scripts); | ||
scripts.forEach(function(script) { | ||
if (!script.type || !script.type.match(/math\/tex/i)) { | ||
return -1; | ||
} | ||
const display = | ||
(script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null); | ||
|
||
const katexElement = document.createElement(display ? "div" : "span"); | ||
katexElement.setAttribute("class", | ||
display ? "equation" : "inline-equation"); | ||
try { | ||
katex.render(script.text, katexElement, { | ||
displayMode: display, | ||
globalGroup: true, | ||
trust: true, | ||
strict: false, | ||
throwOnError: false, | ||
macros | ||
}); | ||
} catch (err) { | ||
//console.error(err); linter doesn't like this | ||
katexElement.textContent = script.text; | ||
} | ||
script.parentNode.replaceChild(katexElement, script); | ||
}); |
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 |
---|---|---|
|
@@ -97,6 +97,7 @@ repr,font,zhu_code | |
亦,亦,Pi | ||
宀,宀,Oo | ||
亠,亠,Oo | ||
{齊頭},亠,Oo | ||
广,广,Uu | ||
户,户,Ie | ||
戸,戸,Ie | ||
|
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
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
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
Oops, something went wrong.