Add utility for creating index entries - #14663
Closed
dinhnguyenminhhoang wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Implement #2914 by centralising creation of index nodes and their cross-reference targets in a reusable
sphinx.util.nodes.make_index()helper.The standard index directive, index role, generic standard-domain targets, and built-in index-producing roles now share the helper while preserving inline/block rendering and index entry metadata. The helper is documented for extension authors, with unit coverage for generated and explicit target IDs.
References
Closes #2914
Testing
ruff check sphinx/util/nodes.py sphinx/roles.py sphinx/domains/std/__init__.py sphinx/domains/index.py tests/test_util/test_util_nodes.pypytest tests/test_util/test_util_nodes.py tests/test_roles.py tests/test_domains/test_domain_std.py tests/test_markup/test_markup.py tests/test_directives/test_directives_no_typesetting.py -q(143 passed, 7 skipped)pytest tests/test_domains tests/test_directives tests/test_util tests/test_roles.py tests/test_markup -q(700 passed, 8 skipped, 1 xfailed; one unrelated Windows newline assertion)sphinx-lintpassedAI Disclosure
AI tools were used to help implement and test this pull request. The author reviewed the resulting changes and validation output.