diff --git a/src/content/docs/en/guides/integrations-guide/mdx.mdx b/src/content/docs/en/guides/integrations-guide/mdx.mdx index e1fbb231b2302..b08b24602686e 100644 --- a/src/content/docs/en/guides/integrations-guide/mdx.mdx +++ b/src/content/docs/en/guides/integrations-guide/mdx.mdx @@ -8,6 +8,7 @@ i18nReady: true --- import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro' import ReadMore from '~/components/ReadMore.astro' +import Since from '~/components/Since.astro' This **[Astro integration][astro-integration]** enables the usage of [MDX](https://mdxjs.com/) components and allows you to create pages as `.mdx` files. @@ -196,7 +197,7 @@ We suggest [using AST Explorer](https://astexplorer.net/) to play with estree ou ### `optimize` -* **Type:** `boolean | { customComponentNames?: string[] }` +* **Type:** `boolean | { ignoreElementNames?: string[] }` This is an optional configuration setting to optimize the MDX output for faster builds and rendering via an internal rehype plugin. This may be useful if you have many MDX files and notice slow builds. However, this option may generate some unescaped HTML, so make sure your site's interactive parts still work correctly after enabling it. @@ -216,11 +217,14 @@ export default defineConfig({ }); ``` -#### `customComponentNames` +#### `ignoreElementNames` * **Type:** `string[]` -An optional property of `optimize` to prevent the MDX optimizer from handling any [custom components passed to imported MDX content via the components prop](/en/guides/markdown-content/#custom-components-with-imported-mdx). +

+Previously known as `customComponentNames`. + +An optional property of `optimize` to prevent the MDX optimizer from handling certain element names, like [custom components passed to imported MDX content via the components prop](/en/guides/markdown-content/#custom-components-with-imported-mdx). You will need to exclude these components from optimization as the optimizer eagerly converts content into a static string, which will break custom components that needs to be dynamically rendered. @@ -235,7 +239,7 @@ import Heading from '../Heading.astro'; ``` -To configure optimization for this using the `customComponentNames` property, specify an array of HTML element names that should be treated as custom components: +To configure optimization for this using the `ignoreElementNames` property, specify an array of HTML element names that should be treated as custom components: ```js title="astro.config.mjs" import { defineConfig } from 'astro/config'; @@ -247,8 +251,7 @@ export default defineConfig({ mdx({ optimize: { // Prevent the optimizer from handling `h1` elements - // These will be treated as custom components - customComponentNames: ['h1'], + ignoreElementNames: ['h1'], }, }), ],