Repository navigation
Fix Lunr search links for inherited members - #482
Open
2836048681 wants to merge 1 commit into
Open
2836048681 wants to merge 1 commit into
2836048681 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
PR body
Lunr search results for inherited members can point to the base class page with a subclass anchor. For example, clicking
Class2.get_a()opens theClass1page but cannot jump to the method section.Use the same documented member to choose both the page and the anchor. By default, inherited results jump to the ancestor's section. With
show_inherited_members=True, they jump to the member rendered on the subclass page. Results still display the name that matched the search.Fixes #416.
Test evidence
python -m unittest -v pdoc.test.CliTest.test_lunr_search_inherited_linkspassed. Before the fix, the regression failed for five inherited entries. The test covers a method, a property, two levels of inheritance, and an override, and checks that each target anchor exists in the generated HTML.python -m unittest -v pdoc.testpassed on Python 3.12. It ran 84 tests with two skips and one expected failure. Output is inw08/tmp/pdoc-fixed.log.show_inherited_members. All four combinations returned links to real anchors. Output is inw08/tmp/pdoc-rendered-search.log.flake8 pdoc setup.pyandgit diff --checkpassed.