Update chapter weight for directed numbers section, modify curriculum structure to include a new basic math notation category, and enhance frontend logic for rendering math content in widget-less chapters.

This commit is contained in:
Hananoshika Yomaru 2026-05-19 23:52:48 -07:00
parent dc3f9d193b
commit b4817dd748
6 changed files with 1031 additions and 7 deletions

View file

@ -36,11 +36,23 @@ function mountFooterYear() {
}
}
function scheduleChapterMath() {
void import("./lib/render-math").then(({ renderBookMath }) => {
requestAnimationFrame(() => renderBookMath());
});
}
function mountChapterWidgets() {
const article = document.querySelector<HTMLElement>("[data-chapter]");
const chapterKey = article?.dataset.chapter;
const mounts = document.querySelectorAll<HTMLElement>("[data-widget]");
if (!chapterKey || mounts.length === 0) return;
if (!article || !chapterKey) return;
// KaTeX must run on widget-less chapters too (renderBookMath was only chained after widgets).
if (mounts.length === 0) {
scheduleChapterMath();
return;
}
void import("./generated/chapter-widgets").then(({ chapterWidgetLoaders }) => {
const loadPromises: Promise<void>[] = [];
@ -62,10 +74,7 @@ function mountChapterWidgets() {
}
void Promise.all(loadPromises).then(() => {
if (!document.querySelector(".book-prose")) return;
void import("./lib/render-math").then(({ renderBookMath }) => {
requestAnimationFrame(() => renderBookMath());
});
scheduleChapterMath();
});
});
}