import dynamic from "next/dynamic"; const CustomCode = (props: any) => { if (props.className?.split(" ").includes("hljs")) { const CopyButton = dynamic(() => import("../clipboard/CopyButton")); // full multi-line code blocks with highlight.js and copy-to-clipboard button return (
{props.children}
); } else { // inline code in paragraphs, headings, etc. (not highlighted) return {props.children}; } }; export default CustomCode;