click_extra.sphinx.changelog moduleΒΆ
Anchor each release of a changelog on its version, like #v1-4-2.
docutils builds the ID of a section from its title, minus the leading digits and
hyphens. That leaves nothing of a release title like 1.4.2 (2026-03-15), so
the section takes the next value of a per-page counter: #id1 for the newest
release. The next release then moves every older one down the counter, and a
saved #id40 link lands on another release.
With RELEASE_ANCHORS_CONFIG set, ReleaseAnchors gives each
section titled like a release an ID made from its version instead. The
transform applies to every page, so it covers a changelog split over several
pages, like an archive of old releases.
- click_extra.sphinx.changelog.RELEASE_ANCHORS_CONFIG = 'click_extra_release_anchors'ΒΆ
Name of the
conf.pyvalue that anchors releases on their version.Falseby default: the version IDs replace the ones a published changelog already carries, so each#idNlink to a release stops working once.
- click_extra.sphinx.changelog.RELEASE_HEADING = re.compile('(?P<version>\\d+\\.\\d+\\.\\d+)(?:\\.\\w+)? \\([^)]+\\)')ΒΆ
Rendered title of a release:
1.4.2 (2026-03-15).The release in preparation carries a
.devNsuffix, and theunreleasedlabel in place of a date:1.5.0.dev0 (unreleased).
- class click_extra.sphinx.changelog.ReleaseAnchors(document, startnode=None)[source]ΒΆ
Bases:
SphinxTransformReplace the ID docutils gave each release section with its version.
The version ID replaces the old one on the section, in the ID and name tables of the document, and in the table myst-parser resolves a
`text <changelog.md#v1-4-2>`_link against. The.devNsuffix of the release in preparation is left out, so its anchor does not change the day it ships.Runs right before
PropagateTargets: the section then holds only the ID docutils gave it, and nothing has read that ID yet.Initial setup for in-place document transforms.
- default_priority = 259ΒΆ
Numerical priority of this transform, 0 through 999 (override).
- click_extra.sphinx.changelog.setup(app)[source]ΒΆ
Register the config value and the release transform on
app.Called from
click_extra.sphinx.setup()so projects only need to list"click_extra.sphinx"in theirextensions. The value rebuilds the environment, since the IDs are set while a page is read.- Return type: