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

Validation is preventing me from using shikiConfig.themes #4245

Closed
1 task done
duncanwerner opened this issue Aug 10, 2022 · 5 comments
Closed
1 task done

Validation is preventing me from using shikiConfig.themes #4245

duncanwerner opened this issue Aug 10, 2022 · 5 comments
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@duncanwerner
Copy link

What version of astro are you using?

1.0.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

WSL

Describe the Bug

Shiki-twoslash is the syntax highlighter used in the Astro MDX integration. It has an option, themes, which supports multiple themes. The intent of this option is to support light/dark theming, because shiki uses inline styles instead of class names.

Reference:
https://github.com/shikijs/twoslash/tree/main/packages/remark-shiki-twoslash#light--dark-modes

Astro's config validation is blocking this property, so I can't use it. It just needs a validation entry in the zod config
https://github.com/withastro/astro/blob/main/packages/astro/src/core/config.ts

and a type in the interface declaration
https://github.com/withastro/astro/blob/main/packages/markdown/remark/src/types.ts

Link to Minimal Reproducible Example

n/a

Participation

  • I am willing to submit a pull request for this issue.
@natemoo-re
Copy link
Member

Thanks for opening an issue @duncanwerner! The switch to Shiki-twoslash happened pretty late in the game before 1.0, so I suspect we just didn't catch this case.

I don't see any reason we couldn't support this, but I'd love @bholmesdev to confirm. Since you seem to have tracked down the issue already, we'd happily review a PR with a fix!

@natemoo-re natemoo-re added - P3: minor bug An edge case that only affects very specific usage (priority) s0-extra-small labels Aug 10, 2022
@duncanwerner
Copy link
Author

Sure I will do that shortly, it's an easy fix. I'm just tracking down some other related issues atm (will post if I find anything useful)

@bholmesdev
Copy link
Contributor

Closing since Shiki-twoslash isn't the default anymore! To add + configure Twoslash, see the "custom syntax highlighting" guide in the MDX README

@kyrylolvov
Copy link

@bholmesdev Is there any documentation on integration of twoslash?

@bholmesdev
Copy link
Contributor

@kyrylolvov ah, I don't think we have official docs on that. I'd suggest installing the shiki twoslash remark plugin, and apply to your remarkPlugins in your astro config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants