fix(html): exclude @internal symbols from the search index#811
Open
crowlbot wants to merge 1 commit into
Open
Conversation
|
|
Symbols hidden from the rendered documentation were still emitted into the search index, so they remained findable. The listing views filter `is_internal` (the `@internal` tag, and non-exported symbols outside of .d.ts mode), but the search index did not, leaving internal named *and* default exports searchable. `@ignore` symbols are already dropped earlier. Apply the same `is_internal` filter when building the search index, for both top-level symbols and drilldown members.
bb32f2f to
2116f80
Compare
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.
Problem
@internal(and@ignore) symbols are excluded from the rendered listings, but a default export tagged@internal/@ignorestill showed up in the generated docs (issue #590).Investigating, the listing views (index, all-symbols) correctly hide internal symbols, but the search index did not filter them, so they stayed findable via search. This affected both named and default exports (and non-exported symbols outside
.d.tsmode), which is why default exports in particular appeared to "not respect" the tags.@ignoresymbols are already dropped earlier in the pipeline.Fix
generate_search_indexwalks every doc node and emits a search entry without checking visibility. The listing views useis_internal(the@internaltag plus non-exported declarations outside.d.tsmode) to hide such symbols; this applies the same filter to the search index, for both top-level symbols and drilldown members (e.g. an@internalmethod on a public class).Test
Added
html_internal_symbols_excluded_from_search: a module with an@internalnamed export, a visible export, and an@internaldefault export. It asserts the visible symbol is in the search index while neither internal export is. It fails before this change and passes after.The
symbol_searchandmultiplesearch-index snapshots are updated: the only entries removed areA(a non-exported class) andB(an@internalexport) from the existing test fixtures — no public symbol is affected.Fixes #590