Giter VIP home page Giter VIP logo

dokka's Introduction

Dokka

Kotlin Beta JetBrains official project Maven Central Gradle Plugin License Revved up by Develocity

Dokka is an API documentation engine for Kotlin.

Just like Kotlin itself, Dokka supports mixed-language projects. It understands Kotlin's KDoc comments and Java's Javadoc comments.

Dokka can generate documentation in multiple formats, including its own modern HTML format, multiple flavors of Markdown, and Java's Javadoc HTML.

Some libraries that use Dokka for their API reference documentation:

You can run Dokka using Gradle, Maven or from the command line. It is also highly pluggable.

Documentation

Comprehensive documentation for Dokka is available on kotlinlang.org

Get started with Dokka

Gradle

Kotlin DSL

Apply the Gradle plugin for Dokka in the root build script of your project:

plugins {
    id("org.jetbrains.dokka") version "1.9.20"
}

When documenting multi-project builds, you need to apply the Gradle plugin for Dokka within subprojects as well:

subprojects {
    apply(plugin = "org.jetbrains.dokka")
}
Groovy DSL

Apply Gradle plugin for Dokka in the root project:

plugins {
    id 'org.jetbrains.dokka' version '1.9.20'
}

When documenting multi-project builds, you need to apply the Gradle plugin for Dokka within subprojects as well:

subprojects {
    apply plugin: 'org.jetbrains.dokka'
}

To generate documentation, run the following Gradle tasks:

  • dokkaHtml for single-project builds
  • dokkaHtmlMultiModule for multi-project builds

By default, the output directory is set to /build/dokka/html and /build/dokka/htmlMultiModule respectively.

To learn more about the Gradle plugin for Dokka, see documentation for Gradle.

Maven

Add the Dokka Maven plugin to the plugins section of your POM file:

<build>
    <plugins>
        <plugin>
            <groupId>org.jetbrains.dokka</groupId>
            <artifactId>dokka-maven-plugin</artifactId>
            <version>1.9.20</version>
            <executions>
                <execution>
                    <phase>pre-site</phase>
                    <goals>
                        <goal>dokka</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

To generate documentation, run the dokka:dokka goal.

By default, the output directory is set to target/dokka.

To learn more about using Dokka with Maven, see documentation for Maven.

CLI

It is possible to run Dokka from the command line without having to use any of the build tools, but it's more difficult to set up and for that reason it is not covered in this section.

Please consult documentation for the command line runner to learn how to use it.

Android

In addition to applying and configuring Dokka, you can apply Dokka's Android documentation plugin, which aims to improve documentation experience on the Android platform:

Gradle Kotlin DSL
dependencies {
    dokkaPlugin("org.jetbrains.dokka:android-documentation-plugin:1.9.20")
}
Gradle Groovy DSL
dependencies {
    dokkaPlugin 'org.jetbrains.dokka:android-documentation-plugin:1.9.20'
}
Maven
<plugin>
    <groupId>org.jetbrains.dokka</groupId>
    <artifactId>dokka-maven-plugin</artifactId>
    ...
    <configuration>
        <dokkaPlugins>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>android-documentation-plugin</artifactId>
                <version>1.9.20</version>
            </plugin>
        </dokkaPlugins>
    </configuration>
</plugin>

Output formats

HTML

HTML is Dokka's default and recommended output format. You can see an example of the output by browsing documentation for kotlinx.coroutines.

HTML format is configurable and, among other things, allows you to modify stylesheets, add custom image assets, change footer message and revamp the structure of the generated HTML pages through templates.

For more details and examples, see documentation for HTML format.

Markdown

Dokka is able to generate documentation in GitHub Flavored and Jekyll compatible Markdown. However, both of these formats are still in Alpha, so you might encounter bugs and migration issues.

For more details and examples, see documentation for Markdown formats.

Javadoc

Dokka's Javadoc output format is a lookalike of Java's Javadoc HTML format. This format is still in Alpha, so you might encounter bugs and migration issues.

Javadoc format tries to visually mimic HTML pages generated by the Javadoc tool, but it's not a direct implementation or an exact copy. In addition, all Kotlin signatures are translated to Java signatures.

For more details and examples, see documentation for Javadoc format.

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.

Learn more about Dokka plugins and their configuration in Dokka plugins.

If you want to learn how to develop Dokka plugins, see Developer guides.

Community

Dokka has a dedicated #dokka channel in Kotlin Community Slack where you can chat about Dokka, its plugins and how to develop them, as well as get in touch with maintainers.

Building and Contributing

See Contributing Guidelines

dokka's People

Contributors

yole avatar semoro avatar kamildoleglo avatar sellmair avatar marcinaman avatar ignatberesnev avatar orangy avatar barkingbad avatar kordyjan avatar vmishenev avatar sellophane avatar pikinier20 avatar sswistun-vl avatar ottergottaott avatar dependabot[bot] avatar jonnyzzz avatar asemy avatar adam-enko avatar goooler avatar whyoleg avatar atyrin avatar krystianujma avatar berezinant avatar 3flex avatar ingokegel avatar kisenka avatar zoobestik avatar supercilex avatar qwwdfsad avatar martinbonnin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.