Skip to content

Commit 9b614ca

Browse files
committed
feat: rehype-pretty-code plugin
1 parent d070c2b commit 9b614ca

File tree

4 files changed

+263
-1
lines changed

4 files changed

+263
-1
lines changed

next.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import createMDX from '@next/mdx'
22
import type { NextConfig } from 'next'
3+
import rehypePrettyCode, { type Options } from 'rehype-pretty-code'
34

45
const nextConfig: NextConfig = {
56
pageExtensions: [
@@ -15,6 +16,16 @@ const nextConfig: NextConfig = {
1516

1617
const withMDX = createMDX({
1718
extension: /\.(md|mdx)$/,
19+
options: {
20+
rehypePlugins: [
21+
[
22+
rehypePrettyCode,
23+
{
24+
theme: 'one-dark-pro',
25+
} as Options,
26+
],
27+
],
28+
},
1829
})
1930

2031
export default withMDX(nextConfig)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"next": "15.3.5",
2121
"react": "^19.1.0",
2222
"react-dom": "^19.1.0",
23+
"rehype-pretty-code": "^0.14.1",
2324
"tailwind-merge": "^3.3.1"
2425
},
2526
"devDependencies": {

0 commit comments

Comments
 (0)