Skip to content

Commit

Permalink
fix: support 'to' of Link
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhansen committed Nov 4, 2024
1 parent 1c802d3 commit 9ef7967
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/MdxProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ export const QueryParam = (props: {param: string, fallback?: string}) => {
return params.get(param) ?? fallback;
};

export const Anchor = (props: {children: React.ReactNode, href: string}) => {
return <a target={props.href?.startsWith('http') ? '_top' : undefined} {...props} />;
export const Anchor = (props: {children: React.ReactNode, href?: string, to?: string}) => {
const href = props.href || props.to;
return <a target={href?.startsWith('http') ? '_top' : undefined} {...props} href={href} />;
}

export const MdxComponents = {
Expand Down

0 comments on commit 9ef7967

Please sign in to comment.