migrate katex ( js portion ) to js bundle
This commit is contained in:
parent
fbafe4f671
commit
bf236e029e
10 changed files with 32 additions and 20 deletions
21
assets/scripts/features/math/katex.js
Normal file
21
assets/scripts/features/math/katex.js
Normal 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 || {}),
|
||||
}
|
||||
);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue