[Material v5] Support mkdocs-localsearch plugin
See original GitHub issueI checked that…
- … the documentation does not mention anything about my idea
- … to my best knowledge, my idea wouldn’t break something for other users
- … there are no open or closed issues that are related to my idea
Description
As discussed in #1306 and mkdocs/mkdocs#1805, Material v5 breaks support for mkdocs-localsearch.
To support the plugin and enable local search (file:// protocol), changes are required on your side.
AFAIK, there are two major issues preventing local search using Material and current browsers:
- The search index is stored as a JSON, but loading JSONs isn’t allowed on file protocol due to CORS.
For Material v4, the mkdocs-localsearch plugin fixes this issue using a modifiedfetch()call. For Material v5, the same can be achieved, e.g., by modifyingajax()as outlined here, but there’s probably a better solution. - The new v5 search engine uses a web worker, but in Chrome, web workers aren’t allowed on file protocol.
Since this is a new issue, this hasn’t been addressed by mkdocs-localsearch before. A possible solution has been outlined here and here.
I don’t expect Material to support local search natively, but it would be great to be able to add that functionality using a plugin and without having to fork the entire Material project.
Any help is much appreciated.
Use Cases
An MkDocs site is stored and accessed by users locally (file:// protocol), e.g., because the files are distributed with a desktop software. Users want to perform search on that site.
Issue Analytics
- State:
- Created 4 years ago
- Comments:38 (38 by maintainers)
Top Results From Across the Web
Setting up site search - Material for MkDocs - GitHub Pages
The built-in search plugin integrates seamlessly with Material for MkDocs, adding multilingual client-side search with lunr and ...
Read more >squidfunk/mkdocs-material - Gitter
Which browser supports 120 MB html file? I want to open an html file which is about 120 MB. please advise. Chrome crashes....
Read more >mkdocs-localsearch - PyPI
A MkDocs plugin to replace the native "search" plugin with a search plugin that also works locally (file:// protocol). Only works with the...
Read more >Material for MkDocs - GitHub
Material for MkDocs always strives to support the latest versions, so ... The following plugins are bundled with the Docker image: ... material-5.0.0">....
Read more >mkdocs-localsearch: Docs, Community, Tutorials | Openbase
NOTE: This plugin only works with the Material for MkDocs theme. If you need support for other themes, feel free to create a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes. I hereby solemnly declare that through the tireless work of @squidfunk, mkdocs-localsearch has risen from the dead and we have a working version for v5! 🎉