Implement syntax highlighting for code blocks in responses - #1704
Open
anshul23102 wants to merge 1 commit into
Open
Implement syntax highlighting for code blocks in responses#1704anshul23102 wants to merge 1 commit into
anshul23102 wants to merge 1 commit into
Conversation
- Integrate marked.js library for markdown to HTML conversion - Configure highlight.js with language auto-detection and fallback to plaintext - Enhance syntax-highlighting.js with renderMarkdownWithSyntaxHighlight() function - Add support for language detection from fenced code block tags - Update CSS to style all pre/code blocks consistently - Support both light and dark theme switching for code blocks - Maintain backward compatibility with existing .issue-snippet and .suggest-example classes
Contributor
Author
|
Thank you for reviewing this PR! This implementation adds comprehensive syntax highlighting support for code blocks in responses using highlight.js and marked.js. When you have a moment, please review the changes and consider adding the following labels:
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1140
Summary
Implements syntax highlighting for fenced code blocks in responses using highlight.js and marked.js. Code snippets now display with proper syntax coloring for improved readability, with automatic language detection and theme-aware styling.
Changes
renderMarkdownWithSyntaxHighlight()function that:<pre><code>blocks (not just specific containers).issue-snippetand.suggest-examplestylingImplementation Details
<pre><code class="language-xxx hljs">structurewindow.highlightAllCode()can be called after dynamic content renderingwindow.renderMarkdownWithSyntaxHighlight()exposed globally for markdown renderingTesting