-
Notifications
You must be signed in to change notification settings - Fork 3
[WEB-64] [EDITOR] Code Blocks :D #352
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
Conversation
…t all text beforehand :/
… everything beforehand
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 some small changes required here and there but besides those it looks amazing! The syntax highlighting looks really clean! your code in general is also very clean :DD
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.
LGTM
Why are the changes needed?
Currently there is no way to add code snippets to documents. This PR adds code blocks to the editor which allows authors to integrate code snippets with syntax highlighting support for 15+ languages!
Changes
CodeContentBlock
to thecse-ui-kit
. Contains the styling for the underlaying code blockCreateCodeBlock
and integrated it intoeditor/index.tsx
.CodeBlock.tsx
contains implementation of code blocks with the following featuresutil/normalize-tokens.ts
: Contains helper function to map between Slate and PrismJS (syntax highlighting library)styles/PrismTheme.tsx
contains stylesheet use for syntax highlighting. Stored as a javascript string to simplify implementation.Screenshots
Basic Demo

Interface when python code snippet is focused

Language selection dropdown menu with full list of supported languages
