-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Light/dark theming for shikiji's codeblocks #8903
Conversation
🦋 Changeset detectedLatest commit: c09aa3a The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -30,17 +30,19 @@ const highlighterCacheAsync = new Map<string, Promise<Highlighter>>(); | |||
export function remarkShiki({ | |||
langs = [], | |||
theme = 'github-dark', | |||
themes = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could elsewhere try to incorporate theme
into themes
but I don't think it's worth it.
(something like themes: {light: theme, ...themes}
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's OK to update the documentation to document this new feature, although I think it should contain "experimental" in its name and the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just speaking for docs here, @horo-fox ! As to whether or not new documentation is needed on our Astro Docs site, when we switched to shikiji in the first place, it seemed to be described as just an internal refactor and we did not update any docs. Our docs do talk about setting shiki
config options etc.
I'll maybe also loop @bluwy in here: do any of our existing docs need to change, or would our users still set shiki
config options, which internally will be processed using shikiji
? My big question is, if users want to set their own syntax highlighting options, do they need to know about shikiji or are we still just referring to it and setting it through a user-facing shiki config?
I suppose they should know about shikiji because the CSS to make this work depends on a bit of implementation detail (the default But I'm not sure if that's what is best. Maybe it might be better to rename the CSS variables (using |
I haven't fully digest the PR and will take a deeper look tomorrow, but the general idea make sense to me. (and also the experimental name). Also from a brief look, the PR isn't covering all the cases yet. I'd suggest looking for files that contain the word It's not great that shiki handling is all over the place in our codebase currently but I'll work on refactoring that soon 😅
Yes I think we can keep referring to setting Talking about this page, there's also the
|
Co-authored-by: Sarah Rainsberger <[email protected]>
I've gone ahead and made a docs PR over at withastro/docs#5191, only PR review comment left is making sure this is complete... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making my review here official! I've also marked the corresponding docs PR as approved, just waiting for this to be released before it's merged live into docs. 🥳
I've gone ahead and checked the files you mentioned and a bit more (the |
Bump for @bluwy in case this got dropped somewhere ^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! The implementation and tests looks clean to me 👍 One small suggestion about the changeset below.
Co-authored-by: Bjorn Lu <[email protected]>
Looks like a merge conflict. I'll resolve it and merge this one shortly |
Co-authored-by: Sarah Rainsberger <[email protected]>
Changes
themes
from markdown configuration to the markdown usage in the markdown package.I would mark this as experimental as shikiji's support is "experimental" but I'm not sure how. I don't think normal versioning guarantees should apply.
Testing
I've added a new test case.
Docs
I avoided documentation because this is experimental (according to shikiji) and I don't think Astro wants to look like it's promising any sort of stability.