Adding functions#2
Merged
Merged
Conversation
Introduce a new config option sphinx_indexed_defs_index_theorems_terms (default false) and update directive handlers to support indexing: only titles, only terms, or both. Add parse_only_terms and parse_title_and_terms helpers and track titles_to_index to avoid duplicate entries and prevent titles from being bolded when force_main is applied to terms. Fix directive registration for lemmas, add Notation to the list of indexable theorem types, and ensure directives return modified nodes. Minor README fixes: typo corrections, note about duplicate-term behavior, and documentation for the new config option. Also add a logger and related imports.
Remove footnotes from indexed titles and terms and add deterministic index ordering based on the external TOC and anchor positions. The extension now strips [^...] footnote markers from directive titles and removes footnote_reference nodes from term strings before indexing. A new patch_index hook is connected on builder-inited that monkeypatches IndexEntries.create_index to sort index references by document order (from Sphinx-external-toc/_toc.yml or external_toc_path) and by anchor position (preferring numeric index anchors). Helper functions build_doc_order and build_anchor_positions compute the sort keys; yaml, os and PurePosixPath imports were added. README updated with warnings about the sorting behavior and a small typo fix.
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.
This pull request updates the documentation in
README.mdto clarify the extension's behavior and configuration options, especially regarding how terms and titles are indexed from various admonition types. It also adds details about sorting and handling of footnotes in index terms.Key documentation improvements:
prf:definitionadmonitions and their titles, correcting minor typos in the introduction.Sphinx-external-tocextension and that the extension patches Sphinx's native index sorting.Configuration option updates:
sphinx_indexed_defs_index_theoremsoption to includeprf:notationadmonitions, both for inclusion and exclusion of titles in the index.sphinx_indexed_defs_index_theorems_terms, to control whether terms from theorem-like admonitions (includingprf:notation) are added to the index.