Building for offline usage¶
If you want to ship your documentation together with your product, MkDocs has you covered – with support from themes, MkDocs allows for building offline-capable documentation. Luckily, Material for MkDocs offers offline support for many of its features.
Built-in offline plugin¶
The plugin will automatically disable
mkdocs.yml, ensuring that users can open your documentation directly from the local file system.
The following configuration options are available:
true– This option specifies whether the plugin is enabled when building your project. If you want to switch the plugin off, e.g. for local builds, use an environment variable:
Now, after invoking
mkdocs build, you can open
site/index.html directly in your browser and the site search will work as if the documentation was hosted on a regular server.
Automatically bundle all external assets
The brand-new built-in privacy plugin makes it easy to use external assets while building documentation for offline usage, as it will automatically download all external assets to distribute them with your documentation.
Material for MkDocs offers many interactive features, some of which will not work from the file system due to the restrictions of modern browsers: all features that use the
fetch API will error.