28 lines
698 B
JavaScript
28 lines
698 B
JavaScript
window.addEventListener("load", () => {
|
|
const macros = {};
|
|
for (const item of new Map(
|
|
Object.entries({
|
|
N: "mathbb{N}",
|
|
R: "mathbb{R}",
|
|
Z: "mathbb{Z}",
|
|
O: "Theta",
|
|
ra: "rightarrow",
|
|
la: "leftarrow",
|
|
RA: "Rightarrow",
|
|
LA: "Leftarrow",
|
|
u: "mu",
|
|
})
|
|
)[Symbol.iterator]()) {
|
|
macros[`\\${item[0]}`] = `\\${item[1]}`;
|
|
}
|
|
|
|
const attribute = "data-math-style";
|
|
for (const element of document.querySelectorAll(`span[${attribute}]`)) {
|
|
katex.render(element.textContent, element, {
|
|
throwOnError: false,
|
|
displayMode: element.getAttribute(attribute) === "display",
|
|
macros,
|
|
output: "mathml",
|
|
});
|
|
}
|
|
});
|