-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
"includeExplanation" missing from types on both codeToHtml and codeToTokens #851
Comments
Why do you need it? The reason it wasn't included because there in Hast/HTML here isn't a useful presentation for the extra scope informations |
Hi @antfu - thanks for the reply. Only the typescript definition for I'm using it at the moment for a custom implementation which converts the inline styles to classes; the built-in styles-to-classes creates a class for the Strictly speaking I don't need a fix as I've used a type assertion but it seemed to be a bug. (unrelated: love the library) |
That's weird, would be great if you could create another issue with reproduction to address that would be great.
Yeah, that's a valid point. Would you like to send a quick PR to fix it? Thanks! |
I forgot I ran into this when I first worked on https://github.com/MichaelMakesGames/shiki-colorized-brackets. As a quick fix, I just cast the type, and that made it's way to this repo when I ported that to @shikijs/colorized-brackets:
We can remove that type cast (and comment above it) with the same PR |
Beyond
so really any of those CodeToTokensOptions could be set on the options passed into codeToCast, and they would be respected |
Validations
Describe the bug
Setting the "includeExplanation" option to true on codeToHtml works as expected but typescript does not recognize it as a valid property. This only causes an error if you use an object literal in the argument, for example:
Current workaround, should anyone see this thread before a fix exists, it to simply typecast:
I'm unable to provide a patch at this time but the fix is straightforward.
Reproduction
See typescript example above
Contributes
The text was updated successfully, but these errors were encountered: