Skip to content

Commit 7ea1ae5

Browse files
fix: use CDATA sections in XML examples to prevent parser errors (#4852) (#6811)
1 parent 6b4ac52 commit 7ea1ae5

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/core/diff/strategies/multi-file-search-replace.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ Search/Replace content:
139139
<file>
140140
<path>eg.file.py</path>
141141
<diff>
142-
<content>
143-
\`\`\`
142+
<content><![CDATA[
144143
<<<<<<< SEARCH
145144
def calculate_total(items):
146145
total = 0
@@ -152,8 +151,7 @@ def calculate_total(items):
152151
"""Calculate total with 10% markup"""
153152
return sum(item * 1.1 for item in items)
154153
>>>>>>> REPLACE
155-
\`\`\`
156-
</content>
154+
]]></content>
157155
</diff>
158156
</file>
159157
</args>
@@ -165,46 +163,40 @@ Search/Replace content with multi edits across multiple files:
165163
<file>
166164
<path>eg.file.py</path>
167165
<diff>
168-
<content>
169-
\`\`\`
166+
<content><![CDATA[
170167
<<<<<<< SEARCH
171168
def calculate_total(items):
172169
sum = 0
173170
=======
174171
def calculate_sum(items):
175172
sum = 0
176173
>>>>>>> REPLACE
177-
\`\`\`
178-
</content>
174+
]]></content>
179175
</diff>
180176
<diff>
181-
<content>
182-
\`\`\`
177+
<content><![CDATA[
183178
<<<<<<< SEARCH
184179
total += item
185180
return total
186181
=======
187182
sum += item
188183
return sum
189184
>>>>>>> REPLACE
190-
\`\`\`
191-
</content>
185+
]]></content>
192186
</diff>
193187
</file>
194188
<file>
195189
<path>eg.file2.py</path>
196190
<diff>
197-
<content>
198-
\`\`\`
191+
<content><![CDATA[
199192
<<<<<<< SEARCH
200193
def greet(name):
201194
return "Hello " + name
202195
=======
203196
def greet(name):
204197
return f"Hello {name}!"
205198
>>>>>>> REPLACE
206-
\`\`\`
207-
</content>
199+
]]></content>
208200
</diff>
209201
</file>
210202
</args>

0 commit comments

Comments
 (0)