mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(site): open README links in new tab (#13264)
This commit is contained in:
@@ -37,11 +37,15 @@ export const Markdown: FC<MarkdownProps> = (props) => {
|
||||
className={className}
|
||||
remarkPlugins={[gfm]}
|
||||
components={{
|
||||
a: ({ href, target, children }) => (
|
||||
<Link href={href} target={target}>
|
||||
{children}
|
||||
</Link>
|
||||
),
|
||||
a: ({ href, children }) => {
|
||||
const isExternal = href?.startsWith("http");
|
||||
|
||||
return (
|
||||
<Link href={href} target={isExternal ? "_blank" : undefined}>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
},
|
||||
|
||||
pre: ({ node, children }) => {
|
||||
if (!node || !node.children) {
|
||||
|
||||
Reference in New Issue
Block a user