Files
paseo/packages/website/src/docs-rehype.ts
T
Mohamed Boudra 65b814c7dc 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.
2026-05-01 21:11:14 +07:00

21 lines
582 B
TypeScript

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: "#" }],
},
},
],
];