A plugin that allows you to have several versions of the documentation built with mkdocs
Project description
mkdocs-multiversion-plugin
mkdocs-multiversion-plugin
is a plugin for mkdocs - a fast, simple and downright gorgeous gorgeous static site generator that's geared towards building project documentation.
mkdocs-multiversion-plugin
allows you to build and have different versions of your project documentation.
How It Works
mkdocs-multiversion-plugin
works by creating a new version of documentation inside mkdocs site_dir/<version>
directory and adds configuration file containing information about versions to site_dir/multiversion.json
. The plugin doesn't create new branches in your git repository.
Setup
Install the plugin using pip:
pip install mkdocs-multiversion-plugin
Next, add the following lines to your mkdocs.yml
:
plugins:
- multiversion
If you have no
plugins
entry in your config file yet, you'll likely also want to add thesearch
plugin. MkDocs enables it by default if there is noplugins
entry set.
Configuration
Guide to all available configuration settings.
To change some behavior of the plugin you need to set proper config option in mkdocs.yml
under plugin section.
plugins:
- multiversion:
branch_whitelist: None
version_in_site_name: False
List of available config options:
Name | Type | Default value | Description |
---|---|---|---|
version_in_site_name |
string | True |
Adds the version name to the mkdocs site_name config. |
branch_whitelist |
string | ^.*$ |
Whitelist branch names, regex. |
tag_whitelist |
string | ^.*$ |
Whitelist tag names, regex. |
latest_version_name_format |
string | latest release ({version}) |
Latest version name format, argument: {version} . |
version_name_format |
string | {version} |
Version name format, argument: {version . |
css_dir |
string | css |
The name of the directory for css files. |
javascript_dir |
string | js |
The name of the directory for javascript files. |
versions_url |
string | '' | The URL for the versions file. |
versions_file_name |
string | multiversion.json , index.php |
The name for the file on the server containing generated versions. |
generate_versions_file |
bool | true | Specifies whether to generate a file with versions. |
versions_provider |
string | static |
Available version providers: php , static . |
If the
generate_versions_file
configuration option is false, you need to deliver the file with the available versions yourself.
The file should contain JSON in the format:
{
"stable" : {
"name" : "stable",
"latest" : false
},
"0.2.0" : {
"latest" : true,
"name" : "latest release (0.2.0)"
},
"0.1.0" : {
"latest" : false,
"name" : "0.1.0"
}
}
Versions provider
There are two documentation versions providers:
- static - static json file generated during building documentation containing versions from git repository.
- php - the dynamic engine that generates a list of available versions on the server. A server with PHP support is required for its operation. Generated versions are a list of directories on the server.
Static provider configuration:
plugins:
- multiversion
PHP provider configuration:
plugins:
- multiversion:
versions_provider: php
It is possible to override name of the static file:
versions_file_name
. Be careful to enter the correct path to the file. In case it is a relative path, the name will be prefixed with the path to the base directory:base_url
.
Contributing
Please note that mkdocs-multiversion-plugin
is currently in Beta and there may be missing feature/documentation so if you could help out by either:
- finding and reporting bugs
- contributing by checking out the issues
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mkdocs-multiversion-plugin-0.2.0.tar.gz
.
File metadata
- Download URL: mkdocs-multiversion-plugin-0.2.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8760cecc7c4043a32807ef272d68b91dee731dbffae46defb109f615977206f3 |
|
MD5 | 540785d139f1f801645332350eee6682 |
|
BLAKE2b-256 | 961895bdc794072ed01d875fa3a31196611dd914e7fbf1eb176180eb2e2cf084 |