mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
Merge pull request #1552 from logto-io/charles-log-3559-readme-links-should-be-opened-in-new-tab
fix(console): external links in readme should be opened in new tab
This commit is contained in:
commit
09cbc693b5
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…
Add table
Reference in a new issue