Kotlin Help

Markdown

Dokka is able to generate documentation in GitHub Flavored and Jekyll compatible Markdown.

These formats give you more freedom in terms of hosting documentation as the output can be embedded right into your documentation website. For example, see OkHttp's API reference pages.

Markdown output formats are implemented as Dokka plugins, maintained by the Dokka team, and they are open source.

GFM

The GFM output format generates documentation in GitHub Flavored Markdown.

The Gradle plugin for Dokka comes with the GFM output format included. You can use the following tasks with it:

Task

Description

dokkaGfm

Generates GFM documentation for a single project.

dokkaGfmMultiModule

A MultiModule task created only for parent projects in multi-project builds. It generates documentation for subprojects and collects all outputs in a single place with a common table of contents.

dokkaGfmCollector

A Collector task created only for parent projects in multi-project builds. It calls dokkaGfm for every subproject and merges all outputs into a single virtual project.

Since GFM format is implemented as a Dokka plugin, you need to apply it as a plugin dependency:

<plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>dokka-maven-plugin</artifactId> ... <configuration> <dokkaPlugins> <plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>gfm-plugin</artifactId> <version>1.9.20</version> </plugin> </dokkaPlugins> </configuration> </plugin>

After configuring this, running the dokka:dokka goal produces documentation in GFM format.

For more information, see the Maven plugin documentation for Other output formats.

Since GFM format is implemented as a Dokka plugin, you need to download the JAR file and pass it to pluginsClasspath.

Via command line options:

java -jar dokka-cli-1.9.20.jar \ -pluginsClasspath "./dokka-base-1.9.20.jar;...;./gfm-plugin-1.9.20.jar" \ ...

Via JSON configuration:

{ ... "pluginsClasspath": [ "./dokka-base-1.9.20.jar", "...", "./gfm-plugin-1.9.20.jar" ], ... }

For more information, see the CLI runner's documentation for Other output formats.

You can find the source code on GitHub.

Jekyll

The Jekyll output format generates documentation in Jekyll compatible Markdown.

The Gradle plugin for Dokka comes with the Jekyll output format included. You can use the following tasks with it:

Task

Description

dokkaJekyll

Generates Jekyll documentation for a single project.

dokkaJekyllMultiModule

A MultiModule task created only for parent projects in multi-project builds. It generates documentation for subprojects and collects all outputs in a single place with a common table of contents.

dokkaJekyllCollector

A Collector task created only for parent projects in multi-project builds. It calls dokkaJekyll for every subproject and merges all outputs into a single virtual project.

Since Jekyll format is implemented as a Dokka plugin, you need to apply it as a plugin dependency:

<plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>dokka-maven-plugin</artifactId> ... <configuration> <dokkaPlugins> <plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>jekyll-plugin</artifactId> <version>1.9.20</version> </plugin> </dokkaPlugins> </configuration> </plugin>

After configuring this, running the dokka:dokka goal produces documentation in GFM format.

For more information, see the Maven plugin's documentation for Other output formats.

Since Jekyll format is implemented as a Dokka plugin, you need to download the JAR file. This format is also based on GFM format, so you need to provide it as a dependency as well. Both JARs need to be passed to pluginsClasspath:

Via command line options:

java -jar dokka-cli-1.9.20.jar \ -pluginsClasspath "./dokka-base-1.9.20.jar;...;./gfm-plugin-1.9.20.jar;./jekyll-plugin-1.9.20.jar" \ ...

Via JSON configuration:

{ ... "pluginsClasspath": [ "./dokka-base-1.9.20.jar", "...", "./gfm-plugin-1.9.20.jar", "./jekyll-plugin-1.9.20.jar" ], ... }

For more information, see the CLI runner's documentation for Other output formats.

You can find the source code on GitHub.

Last modified: 18 November 2024