You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-generated header links ignore mis-anchor headers that start with a number #527
When section headers start with a number, they are labeled in a confusing way by the auto-header anchor generator. They simply have the structure id<num>.
For example, a document like this:
## v2.0## 2.0
Will generate anchors like:
<a class="headerlink" href="#v2-0" title="Permalink to this headline">
<a class="headerlink" href="#id1" title="Permalink to this headline">
I think users would instead expect the ID of the second element to be 2-0
Since we describe the behavior as based on the GitHub sluggify, I also quickly checked and it looks like they do support IDs that start with numbers (that's why I'm labeling this as a bug since I think it breaks from expected behavior based on that criteria).
Just realized another problem this surfaces - if people have multiple numbered sections (e.g. in a changelog, 3.0, 3.1, 3.2) then adding a new section at the top (e.g, 4.0) will bump the id# of all subsequent labels, making links to them valid links, but not to the correct section.
This may be similar to #195, whereby docutils/sphinx seems to treat such references differently.
Should probably track down in the code exactly where/why it is doing this
I think its treating them as "auto-targets", similar to autofootnote; the only fix may be to stick a prefix onto such slugs e.g. `if target.isdigit(): target = "-" + target"
this would not be in keeping with github slug rules, but may be the only way
Activity
choldgraf commentedon Feb 25, 2022
Just realized another problem this surfaces - if people have multiple numbered sections (e.g. in a changelog, 3.0, 3.1, 3.2) then adding a new section at the top (e.g, 4.0) will bump the
id#of all subsequent labels, making links to them valid links, but not to the correct section.chrisjsewell commentedon Feb 25, 2022
This may be similar to #195, whereby docutils/sphinx seems to treat such references differently.
Should probably track down in the code exactly where/why it is doing this
chrisjsewell commentedon Feb 25, 2022
I think its treating them as "auto-targets", similar to autofootnote; the only fix may be to stick a prefix onto such slugs e.g. `if target.isdigit(): target = "-" + target"
this would not be in keeping with github slug rules, but may be the only way
choldgraf commentedon Feb 25, 2022
maybe they could just be prefixed with
num-or evenn-if they started with a number?