"use client"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark } from "react-syntax-highlighter/dist/esm/styles/prism"; const MONOSPACE = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'; const PLAIN_LANGS = new Set(["", "text", "txt", "plain", "plaintext", "none"]); export default function RichCodeBlock({ raw, lang, className, }: { raw: string; lang: string; className?: string; }) { const normalizedLang = (lang || "").toLowerCase(); const isPlain = PLAIN_LANGS.has(normalizedLang); return (
{!isPlain ? (
{normalizedLang}
) : null} {isPlain ? ( // Skip the highlighter entirely for unlabeled / plain blocks so we // don't trigger Prism "unknown language" warnings and keep a tidy // monospace presentation that matches the highlighted variant.
          
            {raw}
          
        
) : ( {raw} )}
); }