Dokka plugins
Dokka was built from the ground up to be easily extensible and highly customizable, which allows the community to implement plugins for missing or very specific features that are not provided out of the box.
Dokka plugins range anywhere from supporting other programming language sources to exotic output formats. You can add support for your own KDoc tags or annotations, teach Dokka how to render different DSLs that are found in KDoc descriptions, visually redesign Dokka's pages to be seamlessly integrated into your company's website, integrate it with other tools and so much more.
If you want to learn how to create Dokka plugins, see Developer guides.
Apply Dokka plugins
Dokka plugins are published as separate artifacts, so to apply a Dokka plugin, you only need to add it as a dependency. From there, the plugin extends Dokka by itself – no further action is needed.
Let's have a look at how you can apply the mathjax plugin to your project:
If you are using the CLI runner with command line options, Dokka plugins should be passed as .jar files to -pluginsClasspath:
If you are using JSON configuration, Dokka plugins should be specified under pluginsClasspath.
Configure Dokka plugins
Dokka plugins can also have configuration options of their own. To see which options are available, consult the documentation of the plugins you are using.
Let's have a look at how you can configure the built-in HTML plugin by adding a custom image to the assets (customAssets option), custom style sheets (customStyleSheets option), and a modified footer message (footerMessage option):
To configure Dokka plugins in a type-safe way, use the dokka.pluginsConfiguration {} block:
For an example of Dokka plugins configuration, see the Dokka's versioning plugin.
Dokka allows you to extend its functionality and modify the documentation generation process by configuring custom plugins.
If you are using the CLI runner with command line options, use the -pluginsConfiguration option that accepts JSON configuration in the form of fullyQualifiedPluginName=json.
If you need to configure multiple plugins, you can pass multiple values separated by ^^.
If you are using JSON configuration, there exists a similar pluginsConfiguration array that accepts JSON configuration in values.
Notable plugins
Here are some notable Dokka plugins that you might find useful:
Name | Description |
|---|---|
Improves the documentation experience on Android | |
Adds version selector and helps to organize documentation for different versions of your application/library | |
Renders MermaidJS diagrams and visualizations found in KDocs | |
Pretty prints mathematics found in KDocs | |
Renders Kotlin signatures as seen from Java's perspective | |
Adds the ability to generate documentation in GitHub Flavoured Markdown format | |
Adds the ability to generate documentation in Jekyll Flavoured Markdown format |
If you are a Dokka plugin author and would like to add your plugin to this list, get in touch with maintainers via Slack or GitHub.