Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rehype Pretty Code Multiple themes not supported #1974

Closed
jay3332 opened this issue Jun 16, 2023 · 4 comments · Fixed by #1992
Closed

Rehype Pretty Code Multiple themes not supported #1974

jay3332 opened this issue Jun 16, 2023 · 4 comments · Fixed by #1992
Milestone

Comments

@jay3332
Copy link
Contributor

jay3332 commented Jun 16, 2023

https://rehype-pretty-code.netlify.app, scroll down to Multiple themes (dark/light mode)

Rehype Pretty Code allows the specification of multiple themes in rehypePrettyCodeOptions, which generates multiple code blocks for every theme allowing for multiple custom themes.

It appears inline code-blocks are correctly handled, however multiline codeblocks only show one of the themes:

Dark theme (correct behavior):
image

Light theme (inline code-blocks display properly, however there no light-theme multiline codeblocks are rendered):
image

Nextra config:

const withNextra = nextra({
  ...
  mdxOptions: {
    rehypePrettyCodeOptions: {
      theme: {
        dark: JSON.parse(readFileSync('./public/syntax/arctis_dark.json', 'utf-8')),
        light: JSON.parse(readFileSync('./public/syntax/arctis_light.json', 'utf-8')),
      },
      getHighlighter: options => getHighlighter({
        ...options,
        langs: [...]
      })
    }
  },
})
@dimaMachina
Copy link
Collaborator

pr welcome

@danielmarinq
Copy link

Is there expected support for multiple themes since marking #1992 as completed?

@dimaMachina
Copy link
Collaborator

in v2 not, in v3 alpha we need update rehype-pretty-code

@dimaMachina
Copy link
Collaborator

@danielmarinq available in https://github.com/shuding/nextra/releases/tag/nextra%403.0.0-alpha.17

@dimaMachina dimaMachina added this to the 3.0 milestone Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants