-
Notifications
You must be signed in to change notification settings - Fork 608
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 rtd-sphinx-search #2805
Add rtd-sphinx-search #2805
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2805 +/- ##
==========================================
- Coverage 72.84% 72.70% -0.14%
==========================================
Files 111 111
Lines 12368 12368
==========================================
- Hits 9009 8992 -17
- Misses 3359 3376 +17 |
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.
I'm running into some bugs related to the theme's search:
First, this shortcut is shown though I think /
is the shortcut used by sphinx.
If I hit Cmd-K
I get:
If I Esc
out of that I get:
Is it possible to just not ship the javascript/ css that the pydata theme uses for search?
Code changes otherwise look good.
No, they have all their JS in one file which we don’t want to re-implement. But I’m pretty sure I know how to fix this issue. |
OK, done! theislab/scanpydoc#128 is released and this PR is updated. I’m not touching the |
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.
Found a couple more things. Mainly shortcut related:
Shortcut overriding system shortcuts
Typically Cmd-Delete
deletes a whole line of text for me. This doesn't happen in the search bar for the pydata sphinx theme. However it does work on the readthedocs site.
Can we prevent the theme from intercepting and overriding this hotkey?
Shortcut opens but does not close search palette
Cmd-K
will open, but not close the search palette. On the pydata sphinx demo site it both opens and closes the palette.
On readthedocs, /
will only open the palette and Esc
is needed to close it (AFAICT).
For both of these, I think it would be nice to just be a bit more consistent with one of the options.
Are any improvements here reasonably easy to do? I recognize that it's making two libraries talk to each other, and at least one of them can't be totally turned off, so this might be difficult.
"Hide search matches" button appearing when it shouldn't (no action needed)
This is unrelated to the PR and seems to happen for all our PR builds. No action needed, just noting it
If I search for something, hit enter to go to the full results, then go back to the main page I get this little banner on top:
Note that this doesn't happen just for search results. It happens for any link I click, eg: table of contents. This doesn't happen on our live sites though.
yes, both things are quite easy, I think. Event listeners can be registered in a way that they don’t capture the event, and toggling the popup is a simple |
All done! The “eats my ctrl/⌘+⌫” problem isn’t from my customizations, it’s pydata/pydata-sphinx-theme#1645 |
Adds readthedocs-sphinx-search support via the scanpydoc theme, which contains JS and CSS customizations to make the search extension integrate with the theme. See
rendered
An alternative that looks nicer would be https://github.com/readthedocs/addons, but it’s still in alpha
PS: I didn’t add the same hack as in scanpydoc that makes the search work in PR builds, so you’ll only see “No results found” in the above. Check out https://icb-scanpydoc.readthedocs-hosted.com/en/latest/?rtd_search=scanpydoc to see rendered search results. You can see that the API works for scanpy: