Commit ce8a2d6
[Repo Assist] Fix incorrect column ranges for inline spans in Markdown parser (#1016)
* Fix incorrect column ranges for inline spans in Markdown parser (#744)
The column positions tracked by parseChars were not advanced after
non-literal inline spans (links, images, inline code), causing all
subsequent spans on the same line to report incorrect StartColumn values.
Root cause: after emitting a DirectLink, IndirectLink, InlineCode or
AutoLink span, the ctx passed to the recursive parseChars call still
had StartColumn pointing at the start of the just-emitted span rather
than past it.
Fix: introduce advanceCtxBy/spanRange helpers and use them to:
- Advance ctx.StartColumn by the consumed character count after each span
- Compute correct EndColumn for each span (StartColumn + consumed length)
- Pass correct body context (StartColumn+1) when parsing link text
Covers: DirectLink, IndirectLink, AutoLink, inline <url> links,
InlineCode (both backtick forms), DirectImage, IndirectImage.
Adds three regression tests from issue #744.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger CI checks
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Don Syme <dsyme@users.noreply.github.com>1 parent af8587a commit ce8a2d6
3 files changed
Lines changed: 178 additions & 19 deletions
File tree
- src/FSharp.Formatting.Markdown
- tests/FSharp.Markdown.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
327 | 344 | | |
328 | 345 | | |
329 | 346 | | |
| |||
390 | 407 | | |
391 | 408 | | |
392 | 409 | | |
393 | | - | |
| 410 | + | |
394 | 411 | | |
395 | 412 | | |
396 | 413 | | |
397 | | - | |
| 414 | + | |
398 | 415 | | |
399 | 416 | | |
400 | 417 | | |
| |||
442 | 459 | | |
443 | 460 | | |
444 | 461 | | |
445 | | - | |
446 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
447 | 465 | | |
448 | 466 | | |
449 | 467 | | |
450 | 468 | | |
451 | 469 | | |
452 | | - | |
| 470 | + | |
453 | 471 | | |
454 | 472 | | |
455 | 473 | | |
456 | | - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
457 | 477 | | |
458 | | - | |
459 | | - | |
| 478 | + | |
| 479 | + | |
460 | 480 | | |
461 | 481 | | |
462 | 482 | | |
463 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
464 | 487 | | |
465 | 488 | | |
466 | 489 | | |
467 | 490 | | |
468 | 491 | | |
469 | 492 | | |
470 | | - | |
471 | | - | |
| 493 | + | |
| 494 | + | |
472 | 495 | | |
473 | 496 | | |
474 | 497 | | |
475 | | - | |
476 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
477 | 501 | | |
478 | 502 | | |
479 | | - | |
| 503 | + | |
480 | 504 | | |
481 | 505 | | |
482 | 506 | | |
483 | | - | |
| 507 | + | |
| 508 | + | |
484 | 509 | | |
485 | | - | |
486 | | - | |
| 510 | + | |
| 511 | + | |
487 | 512 | | |
488 | 513 | | |
489 | 514 | | |
490 | 515 | | |
| 516 | + | |
| 517 | + | |
491 | 518 | | |
492 | 519 | | |
493 | 520 | | |
494 | 521 | | |
495 | 522 | | |
496 | 523 | | |
497 | | - | |
498 | | - | |
| 524 | + | |
| 525 | + | |
499 | 526 | | |
500 | 527 | | |
501 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1129 | 1129 | | |
1130 | 1130 | | |
1131 | 1131 | | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1132 | 1137 | | |
1133 | | - | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1134 | 1265 | | |
1135 | 1266 | | |
1136 | 1267 | | |
| |||
0 commit comments