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

"Hide Search Matches" removes "highlight" parameter from URL #9551

Merged
merged 1 commit into from Jan 13, 2022

Conversation

mgeier
Copy link
Contributor

@mgeier mgeier commented Aug 15, 2021

When clicking "Hide Search Matches", this will modify the URL in the browser, removing the ?highlight=xyz part (without reloading the page).

This makes it easier to share the link without highlighting.

This is a slight variation of a part of #9337. No new history entry is created, though.

Try it out: https://sphinx--9551.org.readthedocs.build/en/9551/extdev/appapi.html?highlight=sphinx

@humitos
Copy link
Contributor

humitos commented Aug 16, 2021

Does it make sense to keep the link and change it to "Show search matches" after clicked to recover the search highlight?

@mgeier
Copy link
Contributor Author

mgeier commented Aug 17, 2021

Does it make sense to keep the link and change it to "Show search matches" after clicked to recover the search highlight?

I wouldn't want this in my theme, because the "Hide search matches" link is placed very prominently and taking quite a lot of space (in order to make it easy to see how to get rid of all the noise). I wouldn't want a "Show search matches" link to waste that same space.

For an example, see https://insipid-sphinx-theme.readthedocs.io/en/0.2.7/intro.html?highlight=search.

In other themes it might not waste that much space, but I'd argue that in most themes the "Hide search matches" link is hard to see anyway because it is too small.

Also, at least in my usage, the highlighting is only active for a short time, while the "Show search matches" link would be active as long as the page is open and most of the time it would just be a distraction.

@mgeier
Copy link
Contributor Author

mgeier commented Dec 9, 2021

Are there any objections to this?

If not, can this please be merged?

@jakobandersen jakobandersen added this to the 4.4.0 milestone Dec 29, 2021
@tk0miya tk0miya added type:enhancement enhance or introduce a new feature html search labels Jan 13, 2022
@tk0miya
Copy link
Member

tk0miya commented Jan 13, 2022

+1: This must be useful!

@tk0miya tk0miya merged commit 3b494b0 into sphinx-doc:4.x Jan 13, 2022
tk0miya added a commit that referenced this pull request Jan 13, 2022
@mgeier mgeier deleted the remove-highlight-param branch January 13, 2022 18:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
html search type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants