Skip to content

Commit 5bf5d8b

Browse files
Detailed use of custom component with imported MDX
Incorporated all review comments from Sarah and Ben manually, because the old branch would not pass the mergeability check.
1 parent 8005f2e commit 5bf5d8b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

packages/integrations/mdx/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,17 @@ Now, writing the standard Markdown blockquote syntax (`>`) will use your custom
343343

344344
#### Custom components with imported `mdx`
345345

346-
When rendering imported MDX content, custom components can also be passed via the `components` prop:
346+
When rendering imported MDX content, custom components can be passed via the `components` prop.
347347

348-
```astro title="src/pages/page.astro" "components={{ h1: Heading }}"
348+
Note: An MDX file's exported components will _not_ be used unless you manually import and pass them via the `components` property. See the example below:
349+
350+
```astro title="src/pages/page.astro" "components={{...components, h1: Heading }}"
349351
---
350-
import Content from '../content.mdx';
352+
import { Content, components } from '../content.mdx';
351353
import Heading from '../Heading.astro';
352354
---
353355
354-
<Content components={{ h1: Heading }} />
356+
<Content components={{...components, h1: Heading }} />
355357
```
356358

357359
### Syntax highlighting

0 commit comments

Comments
 (0)