diff options
author | 2021-08-25 14:17:45 +0200 | |
---|---|---|
committer | 2021-08-25 08:17:45 -0400 | |
commit | 397d8f3d842e7e17d29c4f7862b6639f34f6a2e4 (patch) | |
tree | 3b7c98e31719d7116aa37052dee37acf8178b760 /examples/with-markdown-plugins/astro.config.mjs | |
parent | 3bfd8c125e57879f6d0d3a828943a16199c8fb9c (diff) | |
download | astro-397d8f3d842e7e17d29c4f7862b6639f34f6a2e4.tar.gz astro-397d8f3d842e7e17d29c4f7862b6639f34f6a2e4.tar.zst astro-397d8f3d842e7e17d29c4f7862b6639f34f6a2e4.zip |
Upgrade unified deps and improve unified plugins types (#1200)
* 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
Diffstat (limited to 'examples/with-markdown-plugins/astro.config.mjs')
-rw-r--r-- | examples/with-markdown-plugins/astro.config.mjs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/with-markdown-plugins/astro.config.mjs b/examples/with-markdown-plugins/astro.config.mjs index 690d8f434..fa9d48a1b 100644 --- a/examples/with-markdown-plugins/astro.config.mjs +++ b/examples/with-markdown-plugins/astro.config.mjs @@ -10,8 +10,9 @@ export default /** @type {import('astro').AstroUserConfig} */ ({ // Enable Custom Markdown options, plugins, etc. markdownOptions: { - remarkPlugins: ['remark-code-titles', 'remark-slug', ['remark-autolink-headings', { behavior: 'prepend' }]], + remarkPlugins: ['remark-code-titles', 'remark-slug'], rehypePlugins: [ + ['rehype-autolink-headings', { behavior: 'prepend' }], ['rehype-toc', { headings: ['h2', 'h3'] }], ['rehype-add-classes', { 'h1,h2,h3': 'title' }], ], |