Skip to content

Commit 5b084d4

Browse files
committed
fixbug
1 parent 2e6ea03 commit 5b084d4

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

app/components/markdown.tsx

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -489,40 +489,42 @@ function R_MarkDownContent(props: { content: string }) {
489489
},
490490
],
491491
]}
492-
components={{
493-
pre: PreCode,
494-
code: CustomCode,
495-
p: (pProps) => <p {...pProps} dir="auto" />,
496-
thinkcollapse: ({
497-
title,
498-
children,
499-
}: {
500-
title: string;
501-
children: React.ReactNode;
502-
}) => <ThinkCollapse title={title}>{children}</ThinkCollapse>,
503-
a: (aProps) => {
504-
const href = aProps.href || "";
505-
if (/\.(aac|mp3|opus|wav)$/.test(href)) {
506-
return (
507-
<figure>
508-
<audio controls src={href}></audio>
509-
</figure>
510-
);
511-
}
512-
if (/\.(3gp|3g2|webm|ogv|mpeg|mp4|avi)$/.test(href)) {
513-
return (
514-
<video controls width="99.9%">
515-
<source src={href} />
516-
</video>
517-
);
518-
}
519-
const isInternal = /^\/#/i.test(href);
520-
const target = isInternal ? "_self" : (aProps.target ?? "_blank");
521-
return <a {...aProps} target={target} />;
522-
},
523-
details: Details,
524-
summary: Summary,
525-
}}
492+
components={
493+
{
494+
pre: PreCode,
495+
code: CustomCode,
496+
p: (pProps: any) => <p {...pProps} dir="auto" />,
497+
thinkcollapse: ({
498+
title,
499+
children,
500+
}: {
501+
title: string;
502+
children: React.ReactNode;
503+
}) => <ThinkCollapse title={title}>{children}</ThinkCollapse>,
504+
a: (aProps: any) => {
505+
const href = aProps.href || "";
506+
if (/\.(aac|mp3|opus|wav)$/.test(href)) {
507+
return (
508+
<figure>
509+
<audio controls src={href}></audio>
510+
</figure>
511+
);
512+
}
513+
if (/\.(3gp|3g2|webm|ogv|mpeg|mp4|avi)$/.test(href)) {
514+
return (
515+
<video controls width="99.9%">
516+
<source src={href} />
517+
</video>
518+
);
519+
}
520+
const isInternal = /^\/#/i.test(href);
521+
const target = isInternal ? "_self" : (aProps.target ?? "_blank");
522+
return <a {...aProps} target={target} />;
523+
},
524+
details: Details,
525+
summary: Summary,
526+
} as any
527+
}
526528
>
527529
{escapedContent}
528530
</ReactMarkdown>

0 commit comments

Comments
 (0)