mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): external links in readme should be opened in new tab
This commit is contained in:
parent
f1b241c864
commit
23ff0bf21d
1 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,15 @@ const Markdown = ({ className, children }: Props) => {
|
|||
img: ({ src, alt }) => {
|
||||
return <GithubRawImage src={src} alt={alt} />;
|
||||
},
|
||||
a: ({ href, children }) => {
|
||||
const isExternalLink = href?.startsWith('http');
|
||||
|
||||
return (
|
||||
<a href={href} target={isExternalLink ? '_blank' : '_self'} rel="noopener">
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
},
|
||||
h1: ({ children }) => <h1 id={generateTocId(String(children))}>{children}</h1>,
|
||||
h2: ({ children }) => <h2 id={generateTocId(String(children))}>{children}</h2>,
|
||||
h3: ({ children }) => <h3 id={generateTocId(String(children))}>{children}</h3>,
|
||||
|
|
Loading…
Reference in a new issue