1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

feat(posts): add clean-code

This commit is contained in:
Divlo
2021-11-09 15:14:31 +01:00
parent bcb184e49c
commit 0bf89f4df5
8 changed files with 628 additions and 20 deletions

View File

@ -34,9 +34,14 @@ const BlogPostPage: React.FC<BlogPostPageProps> = (props) => {
<MDXRemote
{...post.source}
components={{
a: (props: React.ComponentPropsWithoutRef<'a'>) => (
<a target='_blank' rel='noopener noreferrer' {...props} />
)
a: (props: React.ComponentPropsWithoutRef<'a'>) => {
if (props.href?.startsWith('#') ?? false) {
return <a {...props} />
}
return (
<a target='_blank' rel='noopener noreferrer' {...props} />
)
}
}}
/>
</div>