hugo-toha/assets/scripts/features/math/katex.js
2023-01-04 18:15:37 -08:00

21 lines
509 B
JavaScript

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 || {}),
}
);
});