Update markdown.tsx

This commit is contained in:
Clarence Dan
2023-04-30 13:24:58 +08:00
committed by GitHub
parent fc8ba3d0b1
commit 3d78375204

View File

@@ -96,7 +96,8 @@ export function Markdown(
components={{
pre: PreCode,
a: (aProps) => {
const isInternal = /^\/#/i.test(aProps.href);
const href = aProps.href || "";
const isInternal = /^\/#/i.test(href);
const target = isInternal ? "_self" : aProps.target ?? "_blank";
return <a {...aProps} target={target} />;
},