Skip to content

Commit a5a6494

Browse files
feat(site): open README links in new tab (#13264)
1 parent 8412450 commit a5a6494

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

site/src/components/Markdown/Markdown.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ export const Markdown: FC<MarkdownProps> = (props) => {
3737
className={className}
3838
remarkPlugins={[gfm]}
3939
components={{
40-
a: ({ href, target, children }) => (
41-
<Link href={href} target={target}>
42-
{children}
43-
</Link>
44-
),
40+
a: ({ href, children }) => {
41+
const isExternal = href?.startsWith("http");
42+
43+
return (
44+
<Link href={href} target={isExternal ? "_blank" : undefined}>
45+
{children}
46+
</Link>
47+
);
48+
},
4549

4650
pre: ({ node, children }) => {
4751
if (!node || !node.children) {

0 commit comments

Comments
 (0)