-
Notifications
You must be signed in to change notification settings - Fork 441
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable highlighting for web search results #2007
Conversation
Always thought it was annoying as well, but I didn't think much of it. Good idea to disable. Implementation is a hack, but it's documented and I don't think we should worry about it being perfect. |
I just noticed that I copied over a syntax error from the answer on SO... let me rebuild the docs to make sure it's still working. It'll take a while. |
I'd like to take some time this release to improve our doc build time. 30 minutes isn't great for CI/CD. |
Codecov Report
@@ Coverage Diff @@
## main #2007 +/- ##
=======================================
Coverage 93.06% 93.06%
=======================================
Files 74 74
Lines 15527 15527
=======================================
Hits 14450 14450
Misses 1077 1077 |
FWIW in MNE-Python for a few years now we have only built on CircleCI (which builds our docs) the examples that have been modified, which makes the doc build much faster (< 10 min rather than ~2 hours for a full build). Then all Code here if interested: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
I've always been bugged by the fact that sphinx search results automatically highlight the search hits on the target page. This usually looks like this:
![Screenshot from 2022-01-07 21-34-44](https://user-images.githubusercontent.com/17914410/148603992-8529b6aa-e8e0-406f-9a66-ed98909b0a19.png)
Note the noisy highlights of each appearance of "plot", even in the left sidebar in unrelated words.
I've done some digging and it seems there's no way to disable this feature altogether, at least I couldn't find anything in the sphinx docs nor in the pydata-sphinx-theme docs. I did find a workaround in this Stack Overflow answer that suggests hacking the highlight colour to be transparent in CSS.
So this PR does exactly that by creating an auxiliary .css file (similarly to the one we already have for the copy button), and injects it in conf.py (the same way that we do for the copy button). The result is nice:
![Screenshot from 2022-01-07 21-35-02](https://user-images.githubusercontent.com/17914410/148604575-0db3eef2-a0aa-449e-b4e8-30a5a076d436.png)
But note that this will still have the
?highlight=...
parameter in the URL, it will merely be a no-op. This is not great but I prefer this to the working highlight feature.Furthermore, I don't actually know what I'm doing here (at all!) so labelling this as review-critical 馃槄 And of course if you think we should keep the default highlighting (cc @pyvista/developers) then we can just close this.