Commit a8cb5cd
authored
Generate IDs for sectionless headings, and improve/fix existing IDs (#4523)
Fixes #4425.
This adds IDs to headings that aren't the first under their respective
parent section, and relies on `@sindresorhus/slugify` to produce
headings, with counters when duplicate labels exist. (This library is an
existing dependency of Eleventy, so it does not increase `npm install`
size.)
This updates _all_ generated IDs to use `slugify` instead of the
previous logic that had been ported from the XSLT process. This means
some subsection IDs may change; it also means some which were previously
inaccessible due to duplicate IDs will be fixed. None of the standard
level-2 headings should be impacted.
I performed extra testing to check for headings that might've been
overlooked by the selector I used here, but all of the first-child cases
involve headings under sections which will already have IDs.1 parent 50ba7ae commit a8cb5cd
File tree
4 files changed
+16
-5
lines changed- 11ty
- understanding
4 files changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
| |||
650 | 653 | | |
651 | 654 | | |
652 | 655 | | |
653 | | - | |
| 656 | + | |
| 657 | + | |
654 | 658 | | |
655 | 659 | | |
656 | 660 | | |
| |||
674 | 678 | | |
675 | 679 | | |
676 | 680 | | |
677 | | - | |
| 681 | + | |
678 | 682 | | |
679 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
680 | 689 | | |
681 | 690 | | |
682 | 691 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments