Skip to content

Commit

Permalink
Merge pull request #1196 from ClarenceDan/main
Browse files Browse the repository at this point in the history
fix: Resolve markdown link issue
  • Loading branch information
Yidadaa authored May 2, 2023
2 parents 56ef8e3 + aeda752 commit 435e82c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ function _MarkDownContent(props: { content: string }) {
]}
components={{
pre: PreCode,
a: (aProps) => {
const href = aProps.href || "";
const isInternal = /^\/#/i.test(href);
const target = isInternal ? "_self" : aProps.target ?? "_blank";
return <a {...aProps} target={target} />;
},
}}
linkTarget={"_blank"}
>
{props.content}
</ReactMarkdown>
Expand Down

0 comments on commit 435e82c

Please sign in to comment.