Better diff highlighting for code blocks#1433
Merged
sfc-gh-dmatthews merged 12 commits intomainfrom Mar 12, 2026
Merged
Conversation
3 tasks
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 7, 2026
Merged
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. |
a20c95a to
97f084e
Compare
3366515 to
d087f89
Compare
b2e3629 to
7c7403f
Compare
d087f89 to
48e964f
Compare
Contributor
Author
Merge activity
|
48e964f to
f30b575
Compare
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.