Skip to content

Commit

Permalink
feat: open links in new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfenB committed Feb 7, 2024
1 parent a6df054 commit df3535c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/13/Changelog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AnchorHTMLAttributes } from 'react';
import { useEffect, useMemo, useState } from 'react';

import type { SxProps, Theme } from '@mui/material';
Expand Down Expand Up @@ -38,8 +39,16 @@ export function Changelog({ cutOff, sx }: Props) {
return (
<Box sx={sx}>
<div className="markdown-body">
<Markdown>{cutOffChangelog}</Markdown>
<Markdown components={{ a: LinkRenderer }}>{cutOffChangelog}</Markdown>
</div>
</Box>
);
}

function LinkRenderer(props: AnchorHTMLAttributes<HTMLAnchorElement>) {
return (
<a href={props.href} rel="noopener noreferrer" target="_blank">
{props.children}
</a>
);
}

0 comments on commit df3535c

Please sign in to comment.