-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: use CDATA sections in XML examples to prevent parser errors (#4852) #6811
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -139,8 +139,7 @@ Search/Replace content: | |||||||||||||||||||||||||||||||||||||
| <file> | ||||||||||||||||||||||||||||||||||||||
| <path>eg.file.py</path> | ||||||||||||||||||||||||||||||||||||||
| <diff> | ||||||||||||||||||||||||||||||||||||||
| <content> | ||||||||||||||||||||||||||||||||||||||
| \`\`\` | ||||||||||||||||||||||||||||||||||||||
| <content><![CDATA[ | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| <content><![CDATA[ | |
| <content> | |
| <![CDATA[ |
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.
Consider adding test coverage for this CDATA implementation. Could we add a test case in multi-search-replace.spec.ts that specifically verifies XML content with special characters (like <<<<<<<, =======, >>>>>>>) wrapped in CDATA sections parses correctly?
Copilot
AI
Aug 7, 2025
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.
[nitpick] The closing CDATA section should be properly indented to match the XML structure. Consider adding appropriate indentation before the closing tags to maintain consistent formatting with the rest of the XML.
| ]]></content> | |
| ]]></content> |
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.
Is the inline CDATA formatting intentional? For better readability, you might consider:
| ]]></content> | |
| <content> | |
| <![CDATA[ | |
| <<<<<<< SEARCH | |
| def calculate_total(items): | |
| total = 0 | |
| for item in items: | |
| total += item | |
| return total | |
| ======= | |
| def calculate_total(items): | |
| """Calculate total with 10% markup""" | |
| return sum(item * 1.1 for item in items) | |
| >>>>>>> REPLACE | |
| ]]> | |
| </content> |
This would make the CDATA boundaries more visually distinct.
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.
Consider adding a comment here explaining why CDATA sections are used, something like:
This would help future developers understand the rationale.