Skip to content

🐛 FIX: Resolve Sphinx footnotes in rST includes - #1244

Open
rayw-lab wants to merge 1 commit into
executablebooks:masterfrom
rayw-lab:codex/fix-rst-include-footnotes
Open

rayw-lab wants to merge 1 commit into
executablebooks:masterfrom
rayw-lab:codex/fix-rst-include-footnotes

Conversation

@rayw-lab

Copy link
Copy Markdown

Refs #1024.

When an rST include uses :parser: myst_parser.sphinx_, the included Markdown is parsed in a temporary document. Its footnotes and references are not registered with the host document, so automatic footnote labels are empty with docutils 0.22, and references can be unresolved with docutils 0.21.

Register the included MyST footnotes and references before the host's footnote transform. Preserve numbering order across rST and Markdown, handle ID collisions with older docutils, and leave nodes from other parsers alone. The tests cover mixed documents and references in both directions across the include.

This addresses the Sphinx path only; standalone docutils includes remain outside the scope of this change.

Tests: tox -e py311-sphinx9, tox -e py311-sphinx8, targeted tests on Sphinx 8 / docutils 0.20.1, and pre-commit run --all-files.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant