Commit 48015fa
committed
Address Copilot review: safe Markdown escaping, matchedText guard, edge-case tests
- Add mdInlineCode() helper using variable-length backtick fence (CommonMark
§6.1) so regex patterns containing backticks produce valid inline code spans.
Reuse for seg.text in match lines.
- buildQueryTitle: use mdInlineCode() for regex queries (fixes embedded
backticks) and JSON.stringify() for plain queries (escapes embedded " and
converts \n so the heading always stays on a single line).
- Fix JSDoc example: '# Results for \`useFlag/i\`' → '# Results for \`/useFlag/i\`'.
- buildJsonOutput: guard matchedText behind seg.text non-empty check, matching
markdown behaviour and preventing '"matchedText": ""' in JSON output.
- Add edge-case tests: plain query with embedded quotes, plain query with
newline, regex with embedded backtick, empty seg.text omitted from JSON.1 parent 9d622dc commit 48015fa
2 files changed
+80
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
302 | 325 | | |
303 | 326 | | |
304 | 327 | | |
| |||
597 | 620 | | |
598 | 621 | | |
599 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
600 | 651 | | |
601 | 652 | | |
602 | 653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
154 | 169 | | |
155 | 170 | | |
156 | 171 | | |
| |||
159 | 174 | | |
160 | 175 | | |
161 | 176 | | |
162 | | - | |
| 177 | + | |
163 | 178 | | |
164 | 179 | | |
165 | 180 | | |
166 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
167 | 186 | | |
168 | 187 | | |
169 | 188 | | |
| |||
232 | 251 | | |
233 | 252 | | |
234 | 253 | | |
235 | | - | |
| 254 | + | |
236 | 255 | | |
237 | 256 | | |
238 | 257 | | |
| |||
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
272 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
273 | 298 | | |
274 | 299 | | |
275 | 300 | | |
| |||
0 commit comments