diff options
Diffstat (limited to '.changeset/metal-cameras-bow.md')
-rw-r--r-- | .changeset/metal-cameras-bow.md | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/.changeset/metal-cameras-bow.md b/.changeset/metal-cameras-bow.md deleted file mode 100644 index 2275c4804..000000000 --- a/.changeset/metal-cameras-bow.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -'@astrojs/markdoc': minor -'astro': patch ---- - -Simplify Markdoc configuration with a new `markdoc.config.mjs` file. This lets you import Astro components directly to render as Markdoc tags and nodes, without the need for the previous `components` property. This new configuration also unlocks passing variables to your Markdoc from the `Content` component ([see the new docs](https://docs.astro.build/en/guides/integrations-guide/markdoc/#pass-markdoc-variables)). - -## Migration - -Move any existing Markdoc config from your `astro.config` to a new `markdoc.config.mjs` file at the root of your project. This should be applied as a default export, with the optional `defineMarkdocConfig()` helper for autocomplete in your editor. - -This example configures an `aside` Markdoc tag. Note that components should be imported and applied to the `render` attribute _directly,_ instead of passing the name as a string: - -```js -// markdoc.config.mjs -import { defineMarkdocConfig } from '@astrojs/markdoc/config'; -import Aside from './src/components/Aside.astro'; - -export default defineMarkdocConfig({ - tags: { - aside: { - render: Aside, - } - } -}); -``` - -You should also remove the `components` prop from your `Content` components. Since components are imported into your config directly, this is no longer needed. - -```diff ---- -- import Aside from '../components/Aside.astro'; -import { getEntryBySlug } from 'astro:content'; - -const entry = await getEntryBySlug('docs', 'why-markdoc'); -const { Content } = await entry.render(); ---- - -<Content -- components={{ Aside }} -/> -``` |