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
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
Describe the bug
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:
Will generate anchors like:
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).
I think the relevant code for this might be here:
https://github.com/executablebooks/mdit-py-plugins/blob/master/mdit_py_plugins/anchors/index.py#L119-L120
originally reported in: jupyterhub/kubespawner#575
Reproduce the bug
Set
myst_heading_anchors = 2
Create a page like
Render it and note the heading IDs
List your environment
No response
The text was updated successfully, but these errors were encountered: