Better diff highlighting for code blocks#1433
Open
sfc-gh-dmatthews wants to merge 11 commits intoccv2-conceptsfrom
Open
Better diff highlighting for code blocks#1433sfc-gh-dmatthews wants to merge 11 commits intoccv2-conceptsfrom
sfc-gh-dmatthews wants to merge 11 commits intoccv2-conceptsfrom
Conversation
3 tasks
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
58eb0b9 to
f786504
Compare
a33f581 to
5be1677
Compare
f786504 to
a3f1c98
Compare
sfc-gh-bnisco
approved these changes
Mar 9, 2026
Comment on lines
+278
to
+280
| // Prism's diff grammar only recognizes +/- prefixes. We use "=" for | ||
| // unchanged lines to keep code aligned (no visual shift) and to preserve | ||
| // leading whitespace that markdown processing would otherwise strip. |
| } | ||
| } | ||
|
|
||
| // Highlight the code block and conditionally enable toolbar plugins (including copy button) |
Contributor
There was a problem hiding this comment.
question: Are these comments intentionally removed?
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.

📚 Context
Code blocks with diff syntax highlighting needed better visual presentation and functionality. The existing implementation didn't properly handle diff-specific languages or provide appropriate visual markers for added/removed lines.
🧠 Description of Changes
Current:
Basic diff code blocks without proper language detection, visual markers, or specialized copy functionality.
Revised:
Enhanced diff code blocks with proper syntax highlighting, visual markers, and improved copy behavior.
diff-<language>syntax (e.g.,diff-python) with proper language detection and display+,−) in the left margin for added/removed linesunchanged-equaltoken support to prevent unintentional trimming of leading whitespace💥 Impact
Size:
🌐 References
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.