Commit cad609d
authored
Rollup merge of rust-lang#117662 - GuillaumeGomez:links-in-headings, r=notriddle
[rustdoc] Allows links in headings
Reopening of rust-lang#94360.
# Explanations
Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this:

<details>
<summary>previous version</summary>

</details>
Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it.
You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html).
cc `@camelid`
r? `@notriddle`File tree
12 files changed
+211
-99
lines changed- src/librustdoc/html
- markdown
- render
- static/css
- tests
- rustdoc-gui
- rustdoc
12 files changed
+211
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
534 | 533 | | |
535 | 534 | | |
536 | 535 | | |
| |||
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
552 | | - | |
| 551 | + | |
553 | 552 | | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
| 553 | + | |
| 554 | + | |
558 | 555 | | |
559 | 556 | | |
560 | 557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
318 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
323 | | - | |
324 | | - | |
| 328 | + | |
| 329 | + | |
325 | 330 | | |
326 | 331 | | |
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
330 | | - | |
331 | | - | |
| 335 | + | |
| 336 | + | |
332 | 337 | | |
333 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
334 | 346 | | |
335 | 347 | | |
336 | 348 | | |
| |||
351 | 363 | | |
352 | 364 | | |
353 | 365 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
360 | 396 | | |
361 | 397 | | |
362 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
1210 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
1211 | 1221 | | |
1212 | 1222 | | |
1213 | | - | |
| 1223 | + | |
1214 | 1224 | | |
1215 | 1225 | | |
1216 | | - | |
| 1226 | + | |
1217 | 1227 | | |
1218 | 1228 | | |
1219 | 1229 | | |
1220 | 1230 | | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
1221 | 1235 | | |
1222 | 1236 | | |
1223 | 1237 | | |
| |||
0 commit comments