397d8f3d84
* Upgrade @astrojs/markdown-support deps and update types * Add changeset * Update changeset * Switch astro-markdown-plugins example to use rehype-autolink-headings Usage of remark-autolink-headings is discouraged in favor of the rehype counterpart: https://github.com/remarkjs/remark-autolink-headings\#remark-autolink-headings * Add stricter types for unified plugins This includes a few suggestions from a code review: - use vfile.toString instead of vfile.value.toString - refactor plugins to follow unified best practices instead of returning functions that return a plugin - use any instead of any[] for plugin options types * Narrow down types to more specific hast or mdast typings
20 lines
774 B
JavaScript
20 lines
774 B
JavaScript
// Full Astro Configuration API Documentation:
|
|
// https://docs.astro.build/reference/configuration-reference
|
|
|
|
// @type-check enabled!
|
|
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
|
// helpful tooltips, and warnings if your exported object is invalid.
|
|
// You can disable this by removing "@ts-check" and `@type` comments below.
|
|
|
|
// @ts-check
|
|
export default /** @type {import('astro').AstroUserConfig} */ ({
|
|
// Enable Custom Markdown options, plugins, etc.
|
|
markdownOptions: {
|
|
remarkPlugins: ['remark-code-titles', 'remark-slug'],
|
|
rehypePlugins: [
|
|
['rehype-autolink-headings', { behavior: 'prepend' }],
|
|
['rehype-toc', { headings: ['h2', 'h3'] }],
|
|
['rehype-add-classes', { 'h1,h2,h3': 'title' }],
|
|
],
|
|
},
|
|
});
|