Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to "skip" adding marked documentation to the search index #11280

Merged
merged 7 commits into from
Feb 12, 2025

Conversation

wlach
Copy link
Contributor

@wlach wlach commented Apr 1, 2023

Purpose

Sometimes when writing documentation that are sections that you do not want to be searchable (e.g. at our company we autogenerate some documentation with a header section which is quite generic and not useful when it comes up in search resuls)

Detail

The following is an example of use:

.. tip::
   :class: noindex

   Fizzbuzz: should not appear in search index

This text *should* appear in the search index.

Works great. It seems in keeping with the general spirit of Docutils classes from what I can tell.

Do this by skipping any node marked with the class "noindex" when
collecting search terms.
@AA-Turner AA-Turner added this to the some future version milestone Apr 29, 2023
@AA-Turner
Copy link
Member

@wlach this seems reasonable. I've taken the liberty to rename to no-search to match the file-wide metadata option.

Please could you add a CHANGES entry and a test? Ideally we would also document this somewhere.

A

@AA-Turner AA-Turner added type:enhancement enhance or introduce a new feature html search labels Jan 10, 2025
@AA-Turner AA-Turner modified the milestones: some future version, 8.2.0 Jan 10, 2025
@wlach
Copy link
Contributor Author

wlach commented Jan 16, 2025

Thanks @AA-Turner, I'll try to find some time to update this in the next couple weeks.

@AA-Turner AA-Turner modified the milestones: 8.2.0, 8.x Feb 7, 2025
@AA-Turner
Copy link
Member

@wlach quick ping in case you have time to look at this before 8.2.

A

@wlach wlach requested a review from AA-Turner February 12, 2025 04:04
@wlach
Copy link
Contributor Author

wlach commented Feb 12, 2025

@wlach quick ping in case you have time to look at this before 8.2.

A

Thanks for the ping. I did what you suggested. I thought of maybe adding something to the docs too, but I couldn't find an obvious place to put it. Should we maybe add a section on "search" at some point?

xkhelm

This comment was marked as duplicate.

@AA-Turner
Copy link
Member

Should we maybe add a section on "search" at some point?

I now realise we have no documentation for the HTML search feature! We should indeed add such a page.

A

@AA-Turner AA-Turner merged commit bb68e72 into sphinx-doc:master Feb 12, 2025
23 checks passed
@wlach wlach deleted the search-noindex branch February 12, 2025 19:46
@AA-Turner AA-Turner modified the milestones: 8.x, 8.2.0 Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html search type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants