Repository navigation
Commit 36e28ff
committed
fix(metadata): keep hyphens in heading slugs like the old doc tooling
#610 replaced the `--+` collapse with `/^(?!-)(?!-+$).*?(--+)/`, which
also swallows everything before the first run of hyphens, so headings
lost their prefix: `-c`, `--check` became `#-check` and
`DEP0062: node --debug` became `#-debug`. nodejs.org/api serves those
anchors today.
The old tooling (getId in tools/doc/html.mjs) never collapsed or
trimmed hyphens: it lowercased, dropped punctuation and turned spaces
into hyphens, which is what github-slugger already does. Dropping the
three hyphen rules matches its anchors for all 5809 headings in
doc/api, where the current rules differ on 18 of them. That's the same
drift #757 reported for `--` flags, which #810 fixed for that one case.
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 7e6bf44 commit 36e28ff
3 files changed
Lines changed: 25 additions & 28 deletions
File tree
- .changeset
- packages/core/src/generators/metadata
- utils/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 10 | | |
14 | 11 | | |
15 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 55 | + | |
| 56 | + | |
70 | 57 | | |
71 | | - | |
72 | 58 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 59 | + | |
| 60 | + | |
76 | 61 | | |
77 | 62 | | |
78 | | - | |
| 63 | + | |
79 | 64 | | |
80 | 65 | | |
| 66 | + | |
81 | 67 | | |
82 | | - | |
83 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
84 | 79 | | |
85 | 80 | | |
86 | 81 | | |
| |||
0 commit comments