-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
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 |
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
097e2d3
to
9b3062a
Compare
cant tell why the tests are failing after merge just by looking at the CI errors. @adhami3310 any ideas? |
… docs discoverability
f7df9c6
to
f3040ab
Compare
* Shiki Code block Experimental * refactor * update code * remove console.log * add transformers to namespace * some validations * fix components paths * fix ruff * add a high-level component * fix mapping * fix mapping * python 3.9+ * see if this fixes the tests * fix pyi and annotations * minimal update of theme and language map * add hack for reflex-web/flexdown * unit test file commit * [ENG-3895] [ENG-3896] Update styling for shiki code block * strip transformer triggers * minor refactor * linter * fix pyright * pyi fix * add unit tests * sneaky pyright ignore * the transformer trigger regex should remove the language comment character * minor refactor * fix silly mistake * component mapping in markdown should use the first child for codeblock * use ternary operator in numbers.py, move code block args to class for docs discoverability * precommit * pyright fix * remove id on copy button animation * pyright fix for real * pyi fix * pyi fix fr * check if svg exists * copy event chain * do a concatenation instead of first child * added comment --------- Co-authored-by: Carlos <[email protected]>
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.