import ReactMarkdown from "react-markdown"; import "katex/dist/katex.min.css"; import RemarkMath from "remark-math"; import RemarkBreaks from "remark-breaks"; import RehypeKatex from "rehype-katex"; import RemarkGfm from "remark-gfm"; import RehypeHighlight from "rehype-highlight"; import { useRef, useState, RefObject, useEffect } from "react"; import { copyToClipboard } from "../utils"; export function PreCode(props: { children: any }) { const ref = useRef(null); return (
       {
          if (ref.current) {
            const code = ref.current.innerText;
            copyToClipboard(code);
          }
        }}
      >
      {props.children}
    
); } const useLazyLoad = (ref: RefObject): boolean => { const [isIntersecting, setIntersecting] = useState(false); useEffect(() => { const observer = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) { setIntersecting(true); observer.disconnect(); } }); if (ref.current) { observer.observe(ref.current); } return () => { observer.disconnect(); }; }, [ref]); return isIntersecting; }; export function Markdown(props: { content: string }) { return ( {props.content} ); }