Better your Sphinx section IDs.
This extension helps keep your permalinks permanent by allowing you to specify a section’s ID. As an example:
.. _v1.2.3:
v1.2.3 (2022-03-19)
-------------------
The permalink on the title will be #v1-2-3 instead of #v1-2-3-2022-03-19. When you change the section title later on, the permalink will still work.
Installation
Download and install this extension using pip:
$ pip install sphinx-better-subsection
Then add this extension in your conf.py:
extensions += ["sphinx_better_subsection"]
Usage
Add a reST internal hyperlink target (the .. _name: syntax) before your section. This extension moves that ID to the front of the IDs list, making the permalink the target’s ID instead of the generated ID from the title. When multiple are found, the last one is used.
This enhances existing reST to do the expected thing and also degrades gracefully when this extension isn’t used (such as in GitHub or online renderers).
Docutils
This package provides a docutils transformer called PreferSectionTarget (subclass of docutils.transforms.Transform) usable via:
from sphinx_better_subsection import PreferSectionTarget
document.transformer.add_transform(PreferSectionTarget)
MyST
As far as I can tell, this extension is compatible with MyST using its header target syntax (the (name)= syntax). The first example in MyST would be:
(v1.2.3)=
## v1.2.3 (2022-03-19)
Links
Source Code: https://github.com/GeeTransit/sphinx-better-subsection
Documentation: https://geetransit.github.io/sphinx-better-subsection/
PyPI Releases: https://pypi.org/project/sphinx-better-subsection/
Metadata
Release files for sphinx-better-subsection 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sphinx_better_subsection-0.2.tar.gz | 3.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_better_subsection-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / sphinx_better_subsection-0.2.tar.gz
| Download URL | sphinx_better_subsection-0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe8dec536894c44fb9e1a01051b6c41111bed4b17d5241c0a3b3c8b2bd1727fb
|
|
BLAKE2b-256 checksum How to use checksums |
3908d2e2e4df0b94d0863f5916ac8e9bebaa51cf5e887371e69ffe2963eafe4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.22.0
|
Release files / sphinx_better_subsection-0.2-py3-none-any.whl
| Download URL | sphinx_better_subsection-0.2-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b24fc36a4a3effb79c49a380c5f7eb3cfbc40bd5db73804cc6f335f9b9b248bb
|
|
BLAKE2b-256 checksum How to use checksums |
6fab4b08ed7d367ebf0965151f07eefc46d669ecc8206f3d74e80e8ea4be9f61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.22.0
|
Security for sphinx-better-subsection 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.