This commit is contained in:
bracesproul
2025-03-17 12:34:31 -07:00
parent 5c6f27b2a1
commit c95623d978
3 changed files with 4129 additions and 2021 deletions

6123
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -196,13 +196,20 @@ const defaultComponents: any = {
{...props}
/>
),
code: ({ className, children, ...props }: { className?: string; children: React.ReactNode }) => {
const match = /language-(\w+)/.exec(className || '');
code: ({
className,
children,
...props
}: {
className?: string;
children: React.ReactNode;
}) => {
const match = /language-(\w+)/.exec(className || "");
if (match) {
const language = match[1];
const code = String(children).replace(/\n$/, '');
const code = String(children).replace(/\n$/, "");
return (
<>
<CodeHeader language={language} code={code} />
@@ -212,13 +219,13 @@ const defaultComponents: any = {
</>
);
}
return (
<code className={cn("rounded font-semibold", className)} {...props}>
{children}
</code>
);
}
},
};
const MarkdownTextImpl: FC<{ children: string }> = ({ children }) => {

View File

@@ -17,7 +17,11 @@ interface SyntaxHighlighterProps {
className?: string;
}
export const SyntaxHighlighter: FC<SyntaxHighlighterProps> = ({ children, language, className }) => {
export const SyntaxHighlighter: FC<SyntaxHighlighterProps> = ({
children,
language,
className,
}) => {
return (
<SyntaxHighlighterPrism
language={language}