How to customize heading anchor links instead of automatically generating them based on heading text? #2819
-
What version of
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
As specified in the Markdown Cheat Sheet from The Markdown Guide linked in the documentation, custom heading IDs are part of the extended syntax which is not supported out of the box by all Markdown applications. This is the case for Starlight but Starlight and Astro supports adding 3rd-party plugins for Markdown & MDX. In this case, you would need to install a plugin like import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import { remarkHeadingId } from "remark-custom-heading-id";
export default defineConfig({
integrations: [starlight({ title: "My Docs" })],
markdown: {
remarkPlugins: [remarkHeadingId],
},
}); After that, a syntax like You can also find more details in this guide: https://docs.astro.build/en/guides/markdown-content/#markdown-plugins |
Beta Was this translation helpful? Give feedback.
As specified in the Markdown Cheat Sheet from The Markdown Guide linked in the documentation, custom heading IDs are part of the extended syntax which is not supported out of the box by all Markdown applications. This is the case for Starlight but Starlight and Astro supports adding 3rd-party plugins for Markdown & MDX.
In this case, you would need to install a plugin like
remark-custom-heading-id
and add it to your configuration: