Commit 43d1b58
committed
Fix external links with anchors being rewritten as relative doc links
Protect <a href="https?://..."> links from linkify so identifiers in the
URL fragment (e.g. #django.http.HttpResponseNotFound) or in the link text
are not turned into relative documentation links. Mask such links with
placeholders before linkify, then restore them after.
Add test_external_link_with_anchor_preserved and testdata module to
verify README/included markdown links to external docs with anchors
remain intact.1 parent 16e00b6 commit 43d1b58
2 files changed
Lines changed: 44 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
| |||
319 | 328 | | |
320 | 329 | | |
321 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
322 | 340 | | |
323 | 341 | | |
324 | 342 | | |
| |||
401 | 419 | | |
402 | 420 | | |
403 | 421 | | |
404 | | - | |
405 | | - | |
406 | | - | |
| 422 | + | |
| 423 | + | |
407 | 424 | | |
408 | 425 | | |
409 | 426 | | |
| |||
429 | 446 | | |
430 | 447 | | |
431 | 448 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
436 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
437 | 456 | | |
438 | 457 | | |
439 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
0 commit comments