Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions components/StyledMarkdownBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,26 @@ export const StyledMarkdownBlock = ({ markdown }: StyledMarkdownBlockProps) => {
const combinedClassName =
`${baseClassName} ${additionalClass}`.trim();

const link =
href.charAt(0) === '/' ? (
<Link
as={href}
href='/'
title={title}
target='_blank'
rel='noopener noreferrer'
className={combinedClassName} // Use the combined className
>
{children}
</Link>
) : (
<a
href={href}
target='_blank'
rel='noopener noreferrer'
title={title}
className={combinedClassName} // Use the combined className
>
{children}
</a>
);
const isInternal = href.startsWith('/') || href.startsWith('#');
const link = isInternal ? (
<Link
href={href}
title={title}
className={combinedClassName} // Use the combined className
>
{children}
</Link>
) : (
<a
href={href}
target='_blank'
rel='noopener noreferrer'
title={title}
className={combinedClassName} // Use the combined className
>
{children}
</a>
);

return <>{link}</>;
},
Expand Down
Loading