import type { GenericNode } from 'mystjs'; import { NodeTypes } from 'myst-util-to-react'; // function Math({ value, html }: { value: string; html: string }) { // const [loaded, setLoaded] = useState(false); // const ref = useRef(null); // useEffect(() => { // import('katex').then(() => { // setLoaded(true); // }); // }, []); // useEffect(() => { // if (!loaded) return; // import('katex').then(({ default: katex }) => { // if (!ref.current) return; // katex.render(value, ref.current, { displayMode: true }); // }); // }, [loaded, ref]); // return ( // <> // {(typeof document === 'undefined' || !loaded) && ( //
// )} // {loaded &&
} // // ); // } const mathBlock = (displayMode: boolean) => (node: GenericNode) => { if (displayMode) { return
; } return ; // return ; }; export const mathRenderers: NodeTypes = { math: mathBlock(true), inlineMath: mathBlock(false), };