Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 47x 32x 30x 1x 1x | import React from 'react';
import ReactMarkdown from 'react-markdown';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
export default function MarkdownText({ content, className = '' }) {
if (!content) return null;
return (
<div className={`prose prose-sm dark:prose-invert max-w-none ${className}`}>
<ReactMarkdown
remarkPlugins={[remarkMath]}
rehypePlugins={[rehypeKatex]}
components={{
p: ({ node, ...props }) => <p className="mb-2 last:mb-0" {...props} />,
a: ({ node, ...props }) => <a className="text-blue-400 hover:underline" target="_blank" rel="noopener noreferrer" {...props} />,
pre: ({ node, ...props }) => <pre className="bg-lab-bg-elevated p-2 rounded-md overflow-x-auto my-2" {...props} />,
code: ({ node, inline, ...props }) =>
inline ? (
<code className="bg-lab-bg-elevated px-1 py-0.5 rounded text-[0.9em]" {...props} />
) : (
<code className="block text-sm" {...props} />
),
}}
>
{String(content)}
</ReactMarkdown>
</div>
);
}
|