Fix diff stringification issues and optimized formatting - #602
Merged
apple502j merged 6 commits intoJun 23, 2026
Conversation
apple502j
requested changes
Jun 21, 2026
apple502j
left a comment
Member
There was a problem hiding this comment.
Breaking change, unfortunately.
Maybe you could make the current stringify an internal API (_stringify), and make stringify call prettyPrintDiff?
Closed
Member
|
@LuYifei2011 I'd appreciate if you could push the changes (or I can handle it myself, if necessary). |
apple502j
approved these changes
Jun 23, 2026
Closed
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.
Resolves #588
Resolves #601
Changes
+-not stringified.+-not at the beginning of the line when stringifying.+-escaping:: -renderingKnown Issues
stringifyfunction of the script and block, we will get a string withDIFF_MARK.Do we need to handle this situation, or at least export
prettyPrintDiff?-diff of the embedded block still cannot be rendered:say (size :: -)(I'm not familiar with rendering, but I might fix it later.)
Details
Fix duplicate
+original code & stringify (fixed):
stringify (before):
Fix
-not stringifiedoriginal code & stringify (fixed):
stringify (before):
Fix
+-not at the beginning of the line when stringifyingoriginal code & stringify (fixed):
stringify (before):
Fix
+-escapingoriginal code & stringify (fixed):
stringify (before):
Fix
:: -renderingcode:


show :: -before:
fixed:
Optimize diff format
new (stringify):
old (stringify):
NOTE: The current logic is that if the script has diffs, the entire script is indented. Perhaps it could be changed to be based on doc?
And I think we should add some tests?