jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
191 stars 29 forks source link

Fix search.highlight feature when loading from file:// URL #180

Closed jbms closed 1 year ago

jbms commented 1 year ago

I don't believe there is any easy way to hide the search highlighting, though, after navigating to a search result. Consequently, I didn't enable it by default for our docs.

2bndy5 commented 1 year ago

I don't believe there is any easy way to hide the search highlighting, though, after navigating to a search result. Consequently, I didn't enable it by default for our docs.

This would actually matches my experience in other Sphinx themes. Typically I click the section permalink to disable search highlighting if it is too annoying (sadly this doesn't always work).

I was excited to see the feature could be disabled at build time for this theme though. However, since the selected text follows the light/dark scheme CSS, it's not a bad idea to enable the feature for our docs. For other light-only schemed themes, I tend to use the "dark reader" browser extension, which looks rather ugly when highlighting search results.

jbms commented 1 year ago

Not exactly related, but for the features that are solely implemented in JavaScript and therefore don't require a rebuild to enable, it could be neat to allow them to be interactively toggled in our docs in order to allow users to experiment with them.

2bndy5 commented 1 year ago

I think some features are excluded from the HTML in the templates if not specifically enabled. We could easily use the task-list directive (+ custom JS in our docs) to implement the toggling.

2bndy5 commented 1 year ago

Incidentally, I was contemplating something similar to the admonition icons because there are sample snippets that provide a complete suggestion for Octicons and FontAwesome.