feat(website): add anchor links to docs headings
Hover a heading to reveal a # link on the left that updates the URL hash without layout shift, matching GitHub README behavior.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
||||
import rehypeSlug from "rehype-slug";
|
||||
import type { PluggableList } from "unified";
|
||||
|
||||
export const docsRehypePlugins: PluggableList = [
|
||||
rehypeSlug,
|
||||
[
|
||||
rehypeAutolinkHeadings,
|
||||
{
|
||||
behavior: "prepend",
|
||||
properties: { className: "heading-anchor", ariaLabel: "Link to this section" },
|
||||
content: {
|
||||
type: "element",
|
||||
tagName: "span",
|
||||
properties: { className: "heading-anchor-icon", ariaHidden: "true" },
|
||||
children: [{ type: "text", value: "#" }],
|
||||
},
|
||||
},
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user