cr
This commit is contained in:
6123
pnpm-lock.yaml
generated
6123
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -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 }) => {
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user