Toggle between rendering modes to see how to add clickable anchor links to headings. Hover over headings in the snippet and renderer modes to reveal the link.
Default Headings
Plain headings with id attributes but no visible anchor links. Users can't easily copy a link to a specific
section.
Headings rendered by svelte-markdown include id attributes by default, but they don't have clickable anchor links. This example shows two ways to add them.
Install the package with your preferred package manager:
pnpm add @humanspeak/svelte-markdownConfigure the component with your markdown source and any options you need.
Import and use the component in your Svelte file.
You can provide a custom slug function for full control over heading IDs.
This is a deeply nested heading to show all levels work correctly.