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.py value that anchors releases on their version.

False by default: the version IDs replace the ones a published changelog already carries, so each #idN link 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 .devN suffix, and the unreleased label in place of a date: 1.5.0.dev0 (unreleased).

class click_extra.sphinx.changelog.ReleaseAnchors(document, startnode=None)[source]ΒΆ

Bases: SphinxTransform

Replace 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 .devN suffix 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).

apply(**kwargs)[source]ΒΆ

Rename the section of each release, if the project opted in.

Return type:

None

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 their extensions. The value rebuilds the environment, since the IDs are set while a page is read.

Return type:

None