-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5bbd36
commit 310f11c
Showing
1 changed file
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
## Next.js MDX Inline Code | ||
## MDX Inline Code | ||
|
||
If you are using the `@renoun/mdx` package, you can also use the `MDXComponents` export to override the `pre` and `code` components in your project's `mdx-components.tsx` file: | ||
When using MDX with the `rehypePlugins` from `renoun/mdx` you can prefix the inline code with a language similar to fenced code blocks. For example: | ||
|
||
```tsx filename="02.mdx-components.tsx" | ||
import { MDXComponents } from 'renoun/components' | ||
|
||
export function useMDXComponents() { | ||
return MDXComponents | ||
} | ||
```mdx | ||
When using inline code `js console.log('Hello, World!')`, you can specify the language for syntax highlighting. | ||
``` | ||
|
||
This properly forwards the MDX component props from the `code` component to the `CodeInline` component. | ||
<Preview> | ||
|
||
When using inline code `js console.log('Hello, World!')`, you can specify the language for syntax highlighting. | ||
|
||
</Preview> | ||
|
||
This will render the inline code with syntax highlighting based on the specified language when used with [MDXComponents](/components/mdx-components). |