diff --git a/examples/with-markdoc/src/content/blog/with-mdx.mdx b/examples/with-markdoc/src/content/blog/with-mdx.mdx new file mode 100644 index 000000000..d3c9d0169 --- /dev/null +++ b/examples/with-markdoc/src/content/blog/with-mdx.mdx @@ -0,0 +1,5 @@ +--- +title: 'Example!' +--- + +# With MDX {frontmatter.title} diff --git a/examples/with-markdoc/src/pages/index.astro b/examples/with-markdoc/src/pages/index.astro index 4e7f63365..5b8b67a9a 100644 --- a/examples/with-markdoc/src/pages/index.astro +++ b/examples/with-markdoc/src/pages/index.astro @@ -5,9 +5,11 @@ import Marquee from '../components/Marquee.astro'; import { getEntryBySlug } from 'astro:content'; import RedP from '../components/RedP.astro'; -const testEntry = await getEntryBySlug('blog', 'test'); -console.log(testEntry); -const { Content } = await testEntry.render(); +const mdocEntry = await getEntryBySlug('blog', 'test'); +const mdxEntry = await getEntryBySlug('blog', 'with-mdx'); +console.log(mdocEntry); +const { Content } = await mdocEntry.render(); +const { Content: MDXContent } = await mdxEntry.render(); --- @@ -21,6 +23,7 @@ const { Content } = await testEntry.render();

Astro

+ = {}): AstroIntegration { return { name: '@astrojs/mdx', hooks: { - 'astro:config:setup': async ({ updateConfig, config, addPageExtension, command }: any) => { + 'astro:config:setup': async ({ + updateConfig, + config, + addPageExtension, + addContentEntryType, + command, + }: any) => { addPageExtension('.mdx'); + addContentEntryType(contentEntryType); const extendMarkdownConfig = partialMdxOptions.extendMarkdownConfig ?? defaultOptions.extendMarkdownConfig;