From 23ff0bf21d7ae77b9856d1f2c3e2ad3f2f4baa23 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Fri, 15 Jul 2022 12:50:29 +0800 Subject: [PATCH] fix(console): external links in readme should be opened in new tab --- packages/console/src/components/Markdown/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/console/src/components/Markdown/index.tsx b/packages/console/src/components/Markdown/index.tsx index 640bd08ec..414873e09 100644 --- a/packages/console/src/components/Markdown/index.tsx +++ b/packages/console/src/components/Markdown/index.tsx @@ -57,6 +57,15 @@ const Markdown = ({ className, children }: Props) => { img: ({ src, alt }) => { return ; }, + a: ({ href, children }) => { + const isExternalLink = href?.startsWith('http'); + + return ( + + {children} + + ); + }, h1: ({ children }) =>

{children}

, h2: ({ children }) =>

{children}

, h3: ({ children }) =>

{children}

,