feat(share): render math

This commit is contained in:
Elian Doran 2025-06-09 21:35:29 +03:00
parent 0ea60fa9d7
commit 8e4bf1538d
No known key found for this signature in database

View File

@ -14,9 +14,19 @@ async function ensureJQuery() {
(window as any).$ = $;
}
async function applyMath() {
const anyMathBlock = document.querySelector("#content .math-tex");
if (!anyMathBlock) {
return;
}
const renderMathInElement = (await import("./services/math.js")).renderMathInElement;
renderMathInElement(document.getElementById("content"));
}
async function formatCodeBlocks() {
const codeBlocks = document.querySelectorAll("#content pre");
if (codeBlocks.length === 0) {
const anyCodeBlock = document.querySelector("#content pre");
if (!anyCodeBlock) {
return;
}
await ensureJQuery();
@ -44,6 +54,7 @@ document.addEventListener(
() => {
formatCodeBlocks();
loadIcons();
applyMath();
const toggleMenuButton = document.getElementById("toggleMenuButton");
const layout = document.getElementById("layout");