Skip to content

Commit

Permalink
add guide for inline highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Oct 15, 2024
1 parent a5bbd36 commit 310f11c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/renoun/src/components/CodeInline.mdx
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).

0 comments on commit 310f11c

Please sign in to comment.