Skip to content

Commit

Permalink
fix unclickable links in TOC / allow passing recmaPlugins in `mdxOp…
Browse files Browse the repository at this point in the history
…tions` (#2866)

aa
  • Loading branch information
dimaMachina committed May 4, 2024
1 parent ec78ba4 commit 6f4c83a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .changeset/pretty-tips-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'nextra-theme-docs': patch
'nextra': patch
---

fix unclickable links in TOC

allow passing `recmaPlugins` in `mdxOptions`
1 change: 1 addition & 0 deletions packages/nextra-theme-docs/src/components/bleed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function Bleed({
<div
className={cn(
'nextra-bleed _relative _-mx-6 _mt-6 md:_-mx-8 2xl:_-mx-24',
'_z-[1]', // for firefox https://github.com/shuding/nextra/issues/2824
full && [
// 'md:mx:[calc(-50vw+50%+8rem)',
'ltr:xl:_ml-[calc(50%-50vw+16rem)] ltr:xl:_mr-[calc(50%-50vw)]',
Expand Down
3 changes: 1 addition & 2 deletions packages/nextra-theme-docs/src/components/toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export function TOC({ toc, filePath }: TOCProps): ReactElement {
<div
className={cn(
'nextra-scrollbar _sticky _top-16 _overflow-y-auto _pr-4 _pt-6 _text-sm [hyphens:auto]',
'_max-h-[calc(100vh-var(--nextra-navbar-height)-env(safe-area-inset-bottom))] ltr:_-mr-4 rtl:_-ml-4',
'_z-[-1]' // for firefox https://github.com/shuding/nextra/issues/2824
'_max-h-[calc(100vh-var(--nextra-navbar-height)-env(safe-area-inset-bottom))] ltr:_-mr-4 rtl:_-ml-4'
)}
>
{hasHeadings && (
Expand Down
4 changes: 3 additions & 1 deletion packages/nextra/src/server/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export async function compileMdx(
outputFormat = 'function-body',
remarkPlugins,
rehypePlugins,
recmaPlugins,
rehypePrettyCodeOptions
}: MdxOptions = mdxOptions

Expand Down Expand Up @@ -344,7 +345,8 @@ export async function compileMdx(
}
}
}) satisfies Plugin<[], Program>,
isRemoteContent ? recmaRewriteFunctionBody : recmaRewriteJsx
isRemoteContent ? recmaRewriteFunctionBody : recmaRewriteJsx,
...(recmaPlugins || [])
].filter(truthy)
})
}
Expand Down
1 change: 1 addition & 0 deletions packages/nextra/src/server/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const nextraConfigSchema = z
mdxOptions: z.strictObject({
rehypePlugins: z.custom<ProcessorOptions['rehypePlugins']>(),
remarkPlugins: z.custom<ProcessorOptions['remarkPlugins']>(),
recmaPlugins: z.custom<ProcessorOptions['recmaPlugins']>(),
format: z.enum(['detect', 'mdx', 'md']),
rehypePrettyCodeOptions: z.custom<RehypePrettyCodeOptions>()
})
Expand Down

0 comments on commit 6f4c83a

Please sign in to comment.