Mkdocs plugin extension.
If extra python packages are required, use python extension: python.pip 'module:version', 'module2:version'.
To override default package version: python.pip 'mkdocs:17.0' (even downgrade is allowed).
See gradle-use-python-plugin for details.
Publishing to github pages is implemented with mkdocs site
| Modifiers | Name | Description |
|---|---|---|
static class |
MkdocsExtension.Publish |
Publication configuration. |
| Type | Name and description |
|---|---|
static java.lang.String[] |
DEFAULT_MODULESThese are default modules required to use mkdocs and mkdocs material. |
java.lang.String |
buildDirDocumentation build directory root. |
java.util.Map<java.lang.String, java.io.Serializable> |
extrasExtra variables to use in markdown files. |
MkdocsExtension.Publish |
publishPublication configuration. |
java.lang.String |
sourcesDirDocumentation sources folder (mkdocs sources root folder). |
boolean |
strictCause mkdocs to abort build on any warning (--strict option of build and serve commands). |
boolean |
updateSiteUrl'site_url' configuration in mkdocs.yml declares full site url. |
| Constructor and description |
|---|
MkdocsExtension
(org.gradle.api.Project project) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.lang.String |
resolveComment() |
|
java.lang.String |
resolveDocPath() |
|
void |
setPublish(groovy.lang.Closure config) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
These are default modules required to use mkdocs and mkdocs material.
Always applied. Module version could be overridden by python pip configuration
python.pip 'mkdocs:0.18.0' (note that version could be also downgraded).
Documentation build directory root. Folder structure is different from usual mkdocs because multi-version
publishing is expected. Mkdocs build task will actually build into '$buildDir/$publish.docPath/'.
If root redirect is enabled (publish as default version) then index.html (with redirect) will be
automatically added at the root folder during the build.
Extra variables to use in markdown files. Requires extra plugin: 'markdownextradata' (plugin module installed by default, but plugin is not activated). To activate plugin, add in mkdocs.yml:
plugins:
- search
- markdownextradata
(search plugin is active by default when plugins section not specified, so have to specify it when declaring
plugins). If plugin is not active, but variables declared, error would be thrown (indicating problem).
When extra variables declared, plugin will generate an additional file:
[mkdocs.yml location]/docs/_data/gradle.yml containing all specified properties.
Markdownextradata plugin loads all yaml files in this directory and so all gradle-defined properties
will be accessible as {{ gradle.prop_key }}. Note that you can create extra data files manually
if required or declare additional (static) variables directly in mkdocs.yml (extra section) - read plugin
documentation for more details.
If variable name would contain spaces or '-', they would be replaced with '_'. For example:
mkdocs.extras = ['long name': 10] would be available as
{{ gradle.long_name }} and
mkdocs.extras = ['other-name': 10] would be available as {{ gradle.other-name }} .
Null values are replaced with empty line: mkdocs.extras = ['name': null] would result in empty value
(name:) in the generated file.
Extra properties file is generated before any mkdocs task, including custom tasks
extending MkdocsTask. After task execution generated file is removed.
In most cases, variable values would be evaluated immediately, but if you need delayed (lazy) evaluation then
use "lazy-closure" trick: extras = ['version': "${-> project.version"]}. This time, version value
would be evaluated only before mkdocs task execution.
Property named "extras" instead of "variables" because markdownextradata refers to extra properties section
by default for variables declaration.
Publication configuration.
Documentation sources folder (mkdocs sources root folder).
Cause mkdocs to abort build on any warning (--strict option of build and serve commands). Disabled by default.
'site_url' configuration in mkdocs.yml declares full site url. Configuration affects meta tag and generated sitemap.xml. With multi-version publication, different site url's must be used for each generated version.
Set root site url into 'site_url' and mkdocsBuild will update mkdocs.yml by adding correct folder to the root path. This way generated site will contain correct urls. After the build original config is reverted (so config will always contain the root url).
Note that config will not be touched if site_url is not defined or multi-version publishing not used. Config will not be changed for mkdocsServe task because it is not important for general documentation development (you can always build final version (with mkdocsBuild) and verify generated urls).
Set to false to disable mkdocs.yml config modification.
Groovy Documentation