Skip to content

Doc: add anchormap directive for anchor redirects#151113

Open
StanFromIreland wants to merge 1 commit into
python:mainfrom
StanFromIreland:anchormap
Open

Doc: add anchormap directive for anchor redirects#151113
StanFromIreland wants to merge 1 commit into
python:mainfrom
StanFromIreland:anchormap

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Jun 8, 2026

Copy link
Copy Markdown
Member

See python/docs-community#134 (and python/docs-community#58) for prior discussion and motivation. The .. anchormap:: lets us declare old-anchor: :ref:`new-target` entries, which the anchor_redirects.py extension resolves at build time and embeds as JSON in the page. A small Javascript script then redirects any achor to its new location.

To see it in action, go to: https://cpython-previews--151113.org.readthedocs.build/en/151113/using/configure.html#cmdoption-with-system-libmpdec

For that example, the extension added to using/configure.html:

<script id="python-docs-anchor-redirects" type="application/json">{"cmdoption-with-system-libmpdec": "../whatsnew/3.16.html#rem-bundled-libmpdec"}</script>
<script type="module" src="../_static/anchor_redirects.js"></script>

In this PR I only removed one entry from removed-ids.txt to serve as an example, the rest can be done in follow-ups.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33047621 | 📁 Comparing e6d0bbe against main (29a920e)

  🔍 Preview build  

1 file changed
± whatsnew/3.16.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant