Skip to content

Add utility for creating index entries - #14663

Closed
dinhnguyenminhhoang wants to merge 1 commit into
sphinx-doc:masterfrom
dinhnguyenminhhoang:codex/issue-2914-index-helper
Closed

Add utility for creating index entries#14663
dinhnguyenminhhoang wants to merge 1 commit into
sphinx-doc:masterfrom
dinhnguyenminhhoang:codex/issue-2914-index-helper

Conversation

@dinhnguyenminhhoang

Copy link
Copy Markdown

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.py
  • pytest 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 dummy documentation build and sphinx-lint passed

AI Disclosure

AI tools were used to help implement and test this pull request. The author reviewed the resulting changes and validation output.

@dinhnguyenminhhoang
dinhnguyenminhhoang deleted the codex/issue-2914-index-helper branch September 1, 2026 13:22
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.

DRY: refactor common functionality in generating index nodes

1 participant