// astro.config.mjs
import { defineConfig } from 'astro/config';
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import mdx from "@astrojs/mdx";
export default defineConfig({
build: {
inlineStylesheets: "never",
},
integrations: [
mdx()
],
markdown: {
rehypePlugins: [
rehypeHeadingIds,
]
},
vite: {
css: {
devSourcemap: true,
},
},
});
#📄MDX - Custom heading ID
18 messages · Page 1 of 1 (latest)
whats the requirement to have a heading id thats different to the heading text?
i have very long titles and its Cyrillic
hmm
its just throw me Could not parse expression with acorn
mdx md.. with plugin.. without plugin (
because thats not valid syntac
syntax
you need an extension to support it like this https://github.com/unicorn-utterances/rehype-slug-custom-id
i dont recommend this btw, you'll now need to think of a custom heading id for every heading, just seems extra work to do
so poor docs. what i have to import in my config
i mean not really, the docs for that link dont know anything about astro
you need to list it here
listed. nothing helpful
tried this. nothing happens
https://github.com/imcuttle/remark-heading-id
what do you mean by tried
tried this plugins
About the ask: I'd also take advantage of custom IDs to be able to not break existing anchor links when renaming sections, for instance. In this case, there would be a fallback to the title-derived ID, if none defined.