diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index 1a150a3..1376528 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/examples/app-router/tsconfig.json b/examples/app-router/tsconfig.json index c714696..b09cc80 100644 --- a/examples/app-router/tsconfig.json +++ b/examples/app-router/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -11,7 +15,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "plugins": [ { @@ -19,9 +23,19 @@ } ], "paths": { - "@/*": ["./*"] + "@/*": [ + "./*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] } diff --git a/examples/pages-router/tsconfig.json b/examples/pages-router/tsconfig.json index 670224f..383d0c2 100644 --- a/examples/pages-router/tsconfig.json +++ b/examples/pages-router/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -11,12 +15,20 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "paths": { - "@/*": ["./*"] + "@/*": [ + "./*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] } diff --git a/packages/mdx/package.json b/packages/mdx/package.json index ef89cd5..3a4d04d 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -103,6 +103,7 @@ "mdast-util-to-hast": "^13.2.0", "next-mdx-remote-client": "^1.0.3", "rehype-katex": "^7.0.1", + "remark-custom-header-id": "^1.0.0", "remark-gfm": "^4.0.0", "remark-math": "^6.0.0", "remark-smartypants": "^3.0.2", diff --git a/packages/mdx/src/client/rsc.tsx b/packages/mdx/src/client/rsc.tsx index b7b504d..8eee60b 100644 --- a/packages/mdx/src/client/rsc.tsx +++ b/packages/mdx/src/client/rsc.tsx @@ -1,6 +1,7 @@ import { MDXRemote as BaseMDXRemote, MDXComponents } from 'next-mdx-remote-client/rsc'; import { SerializeOptions } from 'next-mdx-remote-client/serialize'; import rehypeKatex from 'rehype-katex'; +import remarkCustomHeaderId from 'remark-custom-header-id'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; import remarkSmartypants from 'remark-smartypants'; @@ -41,6 +42,7 @@ export async function MDXRemote({ remarkGfm, remarkSmartypants, remarkMath, + remarkCustomHeaderId, ...(mdxOptions?.remarkPlugins || []), ], rehypePlugins: [ diff --git a/packages/mdx/src/server/index.ts b/packages/mdx/src/server/index.ts index 052482f..a3e8be0 100644 --- a/packages/mdx/src/server/index.ts +++ b/packages/mdx/src/server/index.ts @@ -1,5 +1,6 @@ import { serialize as baseSerialize } from 'next-mdx-remote-client/serialize'; import rehypeKatex from 'rehype-katex'; +import remarkCustomHeaderId from 'remark-custom-header-id'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; import remarkSmartypants from 'remark-smartypants'; @@ -30,6 +31,7 @@ export const serialize = async ({ remarkGfm, remarkSmartypants, remarkMath, + remarkCustomHeaderId, ...(mdxOptions?.remarkPlugins || []), ], rehypePlugins: [ diff --git a/yarn.lock b/yarn.lock index 8689990..ce5bb7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1079,6 +1079,7 @@ __metadata: react: "npm:^19.2.1" react-dom: "npm:^19.2.1" rehype-katex: "npm:^7.0.1" + remark-custom-header-id: "npm:^1.0.0" remark-gfm: "npm:^4.0.0" remark-math: "npm:^6.0.0" remark-smartypants: "npm:^3.0.2" @@ -1931,7 +1932,7 @@ __metadata: languageName: node linkType: hard -"@types/unist@npm:*, @types/unist@npm:^3.0.3": +"@types/unist@npm:*, @types/unist@npm:^3.0.2, @types/unist@npm:^3.0.3": version: 3.0.3 resolution: "@types/unist@npm:3.0.3" checksum: 10c0/2b1e4adcab78388e088fcc3c0ae8700f76619dbcb4741d7d201f87e2cb346bfc29a89003cfea2d76c996e1061452e14fcd737e8b25aacf949c1f2d6b2bc3dd60 @@ -7674,6 +7675,16 @@ __metadata: languageName: node linkType: hard +"remark-custom-header-id@npm:^1.0.0": + version: 1.0.0 + resolution: "remark-custom-header-id@npm:1.0.0" + dependencies: + "@types/unist": "npm:^3.0.2" + unist-util-visit: "npm:^5.0.0" + checksum: 10c0/a8492d5921325ded03dfdccd55e0c4298390f13fcfa00545b7f5c4598bce48e093fe24a8b8c20c6ff92881bcd844de82039086583b4859bcecb84b949ff0a8f8 + languageName: node + linkType: hard + "remark-gfm@npm:^4.0.0": version: 4.0.0 resolution: "remark-gfm@npm:4.0.0"