-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[ENG-3848][ENG-3861]Shiki Code block Experimental #4030
base: main
Are you sure you want to change the base?
Conversation
Could we just include transformers internally in the component so they dont have to define this. Just have all the transformers in there That way we can avoid this line. Or have transformers be a boolean where it's disabled by default but they can enable it with some default styles. Then have a separate prop called custom_transformer where they can add customized ones. I think the current code is a a bit too low level for an end user |
let final_code; | ||
|
||
if (Array.isArray(code)) { | ||
final_code = code[0]; | ||
} else { | ||
final_code = code; | ||
} |
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.
This is more of a hack to get reflex web to run. somehow, a list is sometimes passed as the value of code
. Have a tracking ticket to look into that https://linear.app/reflex-dev/issue/ENG-3893/get-shiki-to-work-with-reflex-web
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.
Does the entire style dictionary get compiled in every time you call it? I wonder if we need to do some optimizations around that
High-level API
With copy button
Using transformers
Low-level API
Shikijs transformer
The shiki transformer is provided via
code_block.transformers
API.Custom transformer
In using custom transformers from third-party libs, we provide a
code_block.create_transformer
API that allows you to specify the library and functions to call from the lib.Some Notes:
code_block.transformers.shikijs
) needs to be improved. The bg colors for the diffs overflow out of the div as well as the line numbers.