import classNames from "classnames"; import CopyButton from "../CopyButton/CopyButton"; import type { ReactNode } from "react"; import styles from "./CodeBlock.module.css"; type Props = { children: ReactNode; className?: string; }; const CodeBlock = ({ children, className, ...rest }: Props) => { if (className?.split(" ").includes("code-highlight")) { // full multi-line code blocks with prism highlighting and copy-to-clipboard button return (
{children}
); } else { // inline code in paragraphs, headings, etc. (not highlighted) return ( {children} ); } }; export default CodeBlock;