Skip to content

Commit d6f2de5

Browse files
committed
Enables internal links to target anchor (html id)
1 parent 790ab48 commit d6f2de5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/link.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ export function setLink(params: { Link: typeof Link }): void {
8989

9090
return <a href={target} target="_blank" {...rest} />;
9191
}
92+
93+
anchor: {
94+
if (target === undefined || !target.startsWith("#")) {
95+
break anchor;
96+
}
97+
98+
return <a href={target} {...rest} />;
99+
}
92100
}
93101

94102
return <params.Link {...props} />;

0 commit comments

Comments
 (0)