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
Is your feature request related to a problem? Please describe.
html permalinks in Chinese docs are not permanent.
For example, given a <h2> titled as "调试方法", sphinx might generate a href="id3" for it; when I insert some <h2>s before it, "调试方法" goes to href="id6" or href="id{x}".
In a result, I'm always frustrated that I can't share my audience a permanent link that jumps to the exact section while keeping updating my docs.
docs generated by Sphinx fail to include Chinese into href ids
.. index.rst
测试
==========
``href`` of the above heading is ``id1``.
测试2
----------
``href`` of the above heading is ``id2``.
测what试
----------
``href`` of the above heading is ``what``.
This is a duplicate of #8709 (at least in the sense, that auto-generated IDs are used in the section "self-link" because of Docutils ID generation rules).
The next version of Docutils should definitely try to solve this issue.
We encounter this issue frequently as well. Thank you @StageDog for bringing it to the official team and for successfully getting it resolved @gmilde .
Thanks for the reproducer and discussion. As mentioned, this is the same underlying issue as #8709: headings that normalize to an empty identifier receive unstable sequential IDs such as id1. This affects Chinese and other non-Latin scripts.
Let’s continue tracking the ID-generation work in #8709. Until then, an explicit target beginning with a letter can provide a stable permalink:
Activity
AA-Turner commentedon Aug 2, 2025
Do you have a minimal reproducer? No member of the core team speaks Chinese, so we will need some help here.
A
StageDog commentedon Aug 2, 2025
sphinx-build . buildon sample.zipAA-Turner commentedon Aug 2, 2025
Plain text:
gmilde commentedon Aug 7, 2025
This is a duplicate of #8709 (at least in the sense, that auto-generated IDs are used in the section "self-link" because of Docutils ID generation rules).
The next version of Docutils should definitely try to solve this issue.
ustccw commentedon Aug 28, 2025
We encounter this issue frequently as well. Thank you @StageDog for bringing it to the official team and for successfully getting it resolved @gmilde .
gmilde commentedon Aug 29, 2025
The issue affects all non-latin alphabets (e.g. Cyrillic and Greek).
A workaround is to use an explicit target made of ASCII characters and starting with a letter. (The last explicit target becomes the section's ID)
The "ref" role requires an explicit refname:
The rST reference syntax works also with the implicit target (but only in
the same source document):
jdillard commentedon Aug 5, 2026
Thanks for the reproducer and discussion. As mentioned, this is the same underlying issue as #8709: headings that normalize to an empty identifier receive unstable sequential IDs such as
id1. This affects Chinese and other non-Latin scripts.Let’s continue tracking the ID-generation work in #8709. Until then, an explicit target beginning with a letter can provide a stable permalink:
Closing as a duplicate of #8709.