23 lines
595 B
JavaScript
23 lines
595 B
JavaScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
//#region src/hooks/useKatexStyles.ts
|
|
let injected = false;
|
|
/**
|
|
* Dynamically injects KaTeX CSS at runtime to avoid the Next.js
|
|
* "Global CSS cannot be imported from within node_modules" build error.
|
|
*
|
|
* Uses a singleton flag so the stylesheet is only injected once.
|
|
*/
|
|
function useKatexStyles() {
|
|
useEffect(() => {
|
|
if (injected || typeof document === "undefined") return;
|
|
injected = true;
|
|
import("katex/dist/katex.min.css").catch(() => {});
|
|
}, []);
|
|
}
|
|
|
|
//#endregion
|
|
export { useKatexStyles };
|
|
//# sourceMappingURL=useKatexStyles.mjs.map
|