Hello, I'm trying to setup .md files and I followed all the steps on the docs but it doesn't work
I'll provide pics of my file tree, my next.config, the mdx-components.tsx file, the error and the .md file
#md files not working
12 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
any kind soul?
Let me spin up my testing env and give it a quick try. Which docs did you follow, these https://nextjs.org/docs/app/building-your-application/configuring/mdx#install-dependencies ?
yes
Okay i got it setup.
Running into the same error.
Renaming / Using mdx instead of .md for /mdx-page/page.mdx "fixes" the issue.
Don't really know why mdx does get picked up but md does not.
ok .mdx kind of works can you try applying a style to the h1 to see if it changes? I tried it but it doesn't take the changes in style ```import type { MDXComponents } from 'mdx/types'
import Image, { ImageProps } from 'next/image'
// This file allows you to provide custom React components
// to be used in MDX files. You can import and use any
// React component you want, including inline styles,
// components from other libraries, and more.
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
// Allows customizing built-in components, e.g. to add styling.
h1: ({ children }) => (
<h1 style={{ color: 'red', fontSize: '48px' }}>{children}</h1>
),
img: (props) => (
<Image
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
{...(props as ImageProps)}
/>
),
...components,
}
}
this is the mdx-components.tsx
oh nice, solved then, thanks