Skip to content

Commit 6f4c83a

Browse files
author
Dimitri POSTOLOV
authoredMay 4, 2024··
fix unclickable links in TOC / allow passing recmaPlugins in mdxOptions (#2866)
aa
1 parent ec78ba4 commit 6f4c83a

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed
 

‎.changeset/pretty-tips-refuse.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'nextra-theme-docs': patch
3+
'nextra': patch
4+
---
5+
6+
fix unclickable links in TOC
7+
8+
allow passing `recmaPlugins` in `mdxOptions`

‎packages/nextra-theme-docs/src/components/bleed.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function Bleed({
1212
<div
1313
className={cn(
1414
'nextra-bleed _relative _-mx-6 _mt-6 md:_-mx-8 2xl:_-mx-24',
15+
'_z-[1]', // for firefox https://github.com/shuding/nextra/issues/2824
1516
full && [
1617
// 'md:mx:[calc(-50vw+50%+8rem)',
1718
'ltr:xl:_ml-[calc(50%-50vw+16rem)] ltr:xl:_mr-[calc(50%-50vw)]',

‎packages/nextra-theme-docs/src/components/toc.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export function TOC({ toc, filePath }: TOCProps): ReactElement {
5656
<div
5757
className={cn(
5858
'nextra-scrollbar _sticky _top-16 _overflow-y-auto _pr-4 _pt-6 _text-sm [hyphens:auto]',
59-
'_max-h-[calc(100vh-var(--nextra-navbar-height)-env(safe-area-inset-bottom))] ltr:_-mr-4 rtl:_-ml-4',
60-
'_z-[-1]' // for firefox https://github.com/shuding/nextra/issues/2824
59+
'_max-h-[calc(100vh-var(--nextra-navbar-height)-env(safe-area-inset-bottom))] ltr:_-mr-4 rtl:_-ml-4'
6160
)}
6261
>
6362
{hasHeadings && (

‎packages/nextra/src/server/compile.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export async function compileMdx(
107107
outputFormat = 'function-body',
108108
remarkPlugins,
109109
rehypePlugins,
110+
recmaPlugins,
110111
rehypePrettyCodeOptions
111112
}: MdxOptions = mdxOptions
112113

@@ -344,7 +345,8 @@ export async function compileMdx(
344345
}
345346
}
346347
}) satisfies Plugin<[], Program>,
347-
isRemoteContent ? recmaRewriteFunctionBody : recmaRewriteJsx
348+
isRemoteContent ? recmaRewriteFunctionBody : recmaRewriteJsx,
349+
...(recmaPlugins || [])
348350
].filter(truthy)
349351
})
350352
}

‎packages/nextra/src/server/schemas.ts

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const nextraConfigSchema = z
102102
mdxOptions: z.strictObject({
103103
rehypePlugins: z.custom<ProcessorOptions['rehypePlugins']>(),
104104
remarkPlugins: z.custom<ProcessorOptions['remarkPlugins']>(),
105+
recmaPlugins: z.custom<ProcessorOptions['recmaPlugins']>(),
105106
format: z.enum(['detect', 'mdx', 'md']),
106107
rehypePrettyCodeOptions: z.custom<RehypePrettyCodeOptions>()
107108
})

0 commit comments

Comments
 (0)
Please sign in to comment.