-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat: Add Syntax Highlighting to Multiline Code Blocks using react-syntax-highlighter #764
base: develop
Are you sure you want to change the base?
Conversation
Hey @abirc8010 |
const code = useMemo( | ||
() => lines.map((line) => line.value.value).join('\n'), | ||
[lines] | ||
); | ||
|
||
useEffect(() => { |
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.
Can we use some other library, so we don't have to load the styles like this and apply styles manually
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.
Since main RC uses this library so I thought of using it
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.
Are they also loading styles this way and manipulating dom element like this?
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.
They are inserting HTML strings and assigning hljs class names. They are also modifying the styles of hljs classes by overriding the predefined CSS of hljs class names.
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.
Mmm, Okay...
Still, I am not in favour of this approach, maybe try some different library, where we don't have to load styles and modify dom elements like this.. Let's keep this PR open, we will compare afterwards
@Spiral-Memory I am using react-syntax-highlighter instead |
Brief Title
Acceptance Criteria fulfillment
monokai
andvs
themes for dark mode and light mode from react-syntax-highlighter .Fixes #763
Video/Screenshots
Screencast.from.2025-01-01.22-49-52.webm
PR Test Details
Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-764 after approval. Contributors are requested to replace
<pr_number>
with the actual PR number.