Skip to main content

MkDocs plugin to extend search functions

Project description

mkdocs-search-izsam

This is a MkDocs plugin that extends native search plugin in order to allow searches work locally. It will write two .js files (one storing a variable for config and one storing a variable for docs) that can be loaded in the theme using:

<script src="{{ 'search/search_config.js'|url }}"></script>
<script src="{{ 'search/search_docs.js'|url }}"></script>

This will allow to avoid CORS problem caused by loadJSON functions and native worker.js model.

Important!

To use .js features and bypass the native worker.js model, the theme should be configured to use the search_index_only option as true:

theme:
  name: null
  custom_dir: your_custom_theme
  include_search_page: true
  search_index_only: true

and then manage search with your favourite js library (in our project we still use lunr.js loaded in a script tag in the theme). For additional information please refer to https://www.mkdocs.org/dev-guide/themes/#search-and-themes.

Setup

Install the plugin using pip:

pip install mkdocs-izsam-search

Activate the plugin in mkdocs.yml:

plugins:
  - izsam-search

It is possible to use same config options of the native search plugin:

- izsam-search:
        lang: en

More information about plugins in the MkDocs documentation.

See Also

Change log

[0.1.8] - 2021-11-10

Implementation of the main feature: build .js files to allow local search and avoid CORS problems

  • Added necessary code in plugin.py
  • Added instruction on README.md

[0.1.7] - 2021-11-10

Configuration error

  • Configuration error: mkdocs_izsam_search.search_index.SearchIndex must be a subclass of mkdocs.plugins.BasePlugin. Changed search_index.py

[0.1.6] - 2021-11-10

Configuration error

  • Configuration error: mkdocs_izsam_search.search_index.SearchIndex must be a subclass of mkdocs.plugins.BasePlugin. Changed entry_points in setup.py

[0.1.5] - 2021-11-10

Setup

  • different syntax for setup()

[0.1.4] - 2021-11-10

Setup

  • entry_points declaration in setup()

[0.1.3] - 2021-11-10

Debug on MANIFEST.in

  • Modified MANIFEST.in there was an error causing import data issues

[0.1.2] - 2021-11-10

Edited

  • README.md

[0.0.1] - 2021-11-10

Added

  • HISTORY.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-izsam-search-0.1.8.tar.gz (91.2 kB view details)

Uploaded Source

Built Distribution

mkdocs_izsam_search-0.1.8-py3-none-any.whl (121.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-izsam-search-0.1.8.tar.gz.

File metadata

  • Download URL: mkdocs-izsam-search-0.1.8.tar.gz
  • Upload date:
  • Size: 91.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for mkdocs-izsam-search-0.1.8.tar.gz
Algorithm Hash digest
SHA256 feff6ff3b5406cab50b4ebc65ecb290069183b912a5305153312453babbcfcb8
MD5 83b080d9f97c99c74bafffc134f0713e
BLAKE2b-256 2aed8eaf4d58b3147ec80a396cb2c039baca7406429c70309e4fdbb87cbed14d

See more details on using hashes here.

File details

Details for the file mkdocs_izsam_search-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_izsam_search-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 121.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for mkdocs_izsam_search-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ecf03d51ae4e51a2ce86b551156504781258751d593174933e812cda73c84913
MD5 6f9580323c5082792857120561022a9c
BLAKE2b-256 ea85d2f66152fd4cf25455ab34828b5a13f8c22671fcbe7e783cf44a3464a280

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page