migrate katex ( js portion ) to js bundle

This commit is contained in:
Aaron Qian 2022-11-11 15:14:56 -08:00 committed by Aaron Qian
parent fbafe4f671
commit bf236e029e
No known key found for this signature in database
GPG key ID: BF1A987C395B5B0E
10 changed files with 32 additions and 20 deletions

View file

@ -0,0 +1,21 @@
import renderMathInElement from 'katex/contrib/auto-render';
import * as params from '@params';
const defaultOptions = {
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "$", right: "$", display: false},
{left: "\\(", right: "\\)", display: false}
]
}
window.addEventListener('DOMContentLoaded', () => {
renderMathInElement(
document.body,
{
...defaultOptions,
...(params.math?.katex || {}),
}
);
});