https://kotlinlang.org logo
Join Slack
Powered by
# dokka
  • s

    solonovamax

    03/06/2025, 10:45 PM
    hey, I just noticed that the dokka plugin template repository has not been updated since dokka 1.9.10 I think it'd probably be a good idea to update it to dokka 2.0.0
    o
    s
    • 3
    • 2
  • l

    Lee Griffiths

    03/18/2025, 4:08 PM
    I have a bunch of kotlin files, and I use KDoc comments inside of them. I want to provide some documentation describing a package as a whole. How do I do that? There's a page here that suggests it's possible: https://kotlinlang.org/docs/dokka-module-and-package-docs.html But it provides 0 details on how to do this, it just says "Documentation for a module as a whole, as well as packages in that module, can be provided as separate Markdown files." without telling me what the path of these files should be. When googling for the kotlin equivalent of
    package-info.java
    you find a lot of links to dead pages/anchors at http://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation but I'm not sure if that's the same contents as the above, or not.
    o
    c
    • 3
    • 4
  • p

    peterthee

    04/01/2025, 11:49 AM
    Hi, I am currently migrating to Dokka 2, but I am unable to define multiple Dokka tasks in order to generate dedicated reports for test or main source code. In Dokka 1, we had the following two gradle tasks that could be executed independently and generated either :
    task generateTestDocs(type: DokkaTask) {
    dokkaSourceSets {
    ...
    }
    }
    task generateAppDocs(type: DokkaTask) {
    dokkaSourceSets {
    ...
    }
    }
    Now in Dokka 2, whenever I register a DokkaTask like so I get an exception:
    tasks.register<DokkaTask>("generateTestDocs") {
    outputDirectory.set(layout.buildDirectory.dir("testDocs"))
    ...
    }
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':generateTestDocs'.
    > java.lang.ClassNotFoundException: org.jetbrains.dokka.DokkaBootstrapImpl
    I have read through the migration guide, but couldnt really determine whether that should still be an option. Generating a single output file does work, but we are required by process to have them independently. Could you give me any suggestion howto generate independent reports for different source sets within one project?
    a
    • 2
    • 6
  • a

    Adrian Landborn

    04/09/2025, 9:17 AM
    Does Dokka Gradle Plugin v2 support Markdown output? I can not wrap my head around it. Thanks
    r
    g
    +4
    • 7
    • 16
  • w

    Waldemar Kornewald

    04/14/2025, 7:35 AM
    Hi, does Dokka v2 support documenting the root module in a multi-module project, so the module overview page can be made more useful?
    h
    o
    • 3
    • 5
  • c

    CLOVIS

    04/21/2025, 1:06 PM
    Hey! Could someone please take a look at https://github.com/Kotlin/dokka/issues/4074?
    o
    • 2
    • 1
  • r

    Rok Oblak

    04/25/2025, 7:22 PM
    Hi, it may be a newbie question, but I did not see it mentioned - the generated HTML pages are huge because every single element is standalone and duplicated. So a single enum entry html page takes 160 lines of code. Meaning if I want to embed a quite small API reference as a static page in my website, it will take many tens of thousands of lines. Is this expected and is there no way around it?
    v
    • 2
    • 1
  • c

    CLOVIS

    05/03/2025, 5:39 PM
    I don't understand how the all-modules-page plugin works. Looking at the source of the
    org.jetbrains.dokka.gradle.formats.DokkaHtmlPlugin
    , there is a check but no configuration at all. The Javadoc plugin doesn't aggregate modules, and the other formats haven't been migrated to the Gradle plugin?
    a
    • 2
    • 29
  • k

    kevin.cianfarini

    05/05/2025, 6:03 PM
    Is there an easy way to parameterize Dokka module documentation? I have a section of my docs that looks something like this in the getting started section:
    Copy code
    [versions]
    cardiologist = "0.3.1"
    
    [libraries]
    cardiologist = { module = "io.github.kevincianfarini.cardiologist:cardiologist", version.ref = "cardiologist" }
    I want to parameterize the version number
    0.3.1
    so that I can inject it from my
    gradle.properties
    file. Is that possible?
    e
    a
    • 3
    • 4
  • t

    Tomas Kormanak

    05/13/2025, 11:30 AM
    Hi, I've upgraded version of Jackson in our project and dokka plugin stopped working. It says
    Copy code
    * What went wrong:
    Execution failed for task ':app:dokkaGeneratePublicationHtml'.
    > A failure occurred while executing org.jetbrains.dokka.gradle.workers.DokkaGeneratorWorker
       > 'void com.fasterxml.jackson.databind.type.TypeFactory.<init>(com.fasterxml.jackson.databind.util.LRUMap)'
    I tried this workaround to force dokka to use older Jackson, but it seems it does not work. https://github.com/Kotlin/dokka/issues/3472#issuecomment-2244628081 Any idea how to solve it?
    o
    • 2
    • 1
  • j

    Junbin Park

    05/16/2025, 3:57 AM
    Hi is there a way to load the child projects' custom assets to the root in dokka multi module? Seems like when there's a multi module configuration applied, the assets from the child projects defined with
    dokka(projects.x.y.z)
    is not loaded along with it.
    o
    • 2
    • 4
  • s

    Sebastien Leclerc Lavallee

    05/20/2025, 10:20 PM
    Hello! I'm configuring dokka currently and wanted to include the changelog file in my generated HTML I have this at the root
    build.gradle.kts
    :
    Copy code
    subprojects {
      apply("com.dokka...")
    
      afterEvaluate {
        dokka {
         dokkaPublications.html {
          moduleName.set("SOME - " + project.name)
          includes.from(project.layout.projectDirectory.file("CHANGELOG.md"))
         }
        }
      }
    }
    The file is at the correct location for each subproject, but I don't see my changelog file when I execute
    ./gradlew dokkaGenerate
    Is there anything missing ? Is that something that's possible? Thanks! 🙂
    j
    a
    • 3
    • 27
  • s

    Sebastien Leclerc Lavallee

    05/20/2025, 10:40 PM
    Also on another note... I generate that documentation for a library. I would like to exclude all code that is
    internal
    in each of my modules since it's not visible for anyone using the library? Thanks again!
    a
    • 2
    • 2
  • s

    Steven Zeck

    05/28/2025, 3:45 AM
    Hi all. I'm reading over changes for 2.0.0 and have a question about multi-module projects. How do you share Dokka configuration across modules and aggregate documentation from all of the modules? I've tried doing it this way in dokka-convention.gradle.kts, but it doesn't aggregate.
    Copy code
    plugins {
        id("org.jetbrains.dokka")
    }
    
    dokka {
        dokkaSourceSets.configureEach {
            reportUndocumented = false
            skipEmptyPackages = false
            skipDeprecated = true
        }
    
        dokkaPublications.html {
            outputDirectory.set(layout.buildDirectory.dir("docs"))
        }
    }
    
    dependencies {
        dokka(project(":project1"))
        dokka(project(":project2"))
    }
    And in each modules build.gradle.kts
    Copy code
    plugins {
      id("dokka-convention")
    }
    h
    • 2
    • 4
  • s

    Steven Zeck

    05/31/2025, 2:23 AM
    Ok got that working. Can you inject your own content in there, such as a getting started markdown file without having to do
    # Package
    or
    # Module
    ?
    h
    v
    • 3
    • 2
  • e

    Edoardo Luppi

    06/05/2025, 4:28 PM
    I'm migrating to Dokka v2, and after reading the migration steps there is still one point that's unclear. I currently have
    Copy code
    dokkaHtmlPartial {
      dependsOn(generateKotlinGrammarSource) // ANTLR task
    }
    in my sub-module build script. What's the correct task to use in place of
    dokkaHtmlPartial
    for this specific case?
    a
    • 2
    • 16
  • e

    Edoardo Luppi

    06/05/2025, 5:16 PM
    Is it expected in v2 to see
    Copy code
    > Task :module-name:logLinkDokkaGeneratePublicationHtml
    Generated Dokka HTML publication: localhost URL
    for every sub-module, even when I'm running
    dokkaGenerate
    at the top level with aggregation?
    a
    • 2
    • 7
  • e

    Edoardo Luppi

    06/05/2025, 5:29 PM
    Sharing my immediate feedback after the migration. 1. Setting a custom logo also required overwriting some CSS properties, otherwise the logo was stretched horizontally.
    Copy code
    .library-name--link::before {
      background-size: var(--dokka-logo-height) var(--dokka-logo-width);
      max-height: unset;
      max-width: unset;
    }
    2. The sidebar paddings are bit too much imo. 3. The hover highlight appears only on the package name or the toggle arrow, but not on both at the same time (is it intended?)
    o
    • 2
    • 1
  • n

    Nathan Fallet

    06/07/2025, 1:28 PM
    Hello! I wanted to know if there is a simple way to add custom markdown files. Like there is the kdoc, and I want to add an example/tutorial section in the menu, imported from markdown files (would seem to be the easiest option) There has to be an option or plugin for this (otherwise I’m making a plugin for it)
    h
    o
    • 3
    • 6
  • s

    Skolson5903

    06/14/2025, 1:46 AM
    Hopefully a quick question. I'm converting a kotlin multi-platform (KMP) library project to Dokka 2. I'm having trouble getting the HTML generated, and the doc at Dokka V 2.0 migration guide looks incorrect. It claims that this should be valid in the dokka block in build.gradle.kts:
    dokkaPublications.html {
    outputDirectory.set(rootDir.resolve("docs/api/0.x"))
    includes.from(project.layout.projectDirectory.file("README.md"))
    }
    but when I try this the html clause is an unresolved reference (using Idea 2025.2 EAP). And using the snippet below the builds/dokka folder has only an empty javadoc subfolder, so nothing is being generated. Since this is KMP I know V 2.0.0 doesn't support the javadoc option. What do I need to add to get the HTML to generate? Here's my beginning dokka snippet:
    Copy code
    dokka {
        moduleName.set("Kotlin Multiplatform Common IO Library")
        dokkaSourceSets.commonMain {
            includes.from("$appleFrameworkName.md")
        }
    }
    Also, as a followup, I've struggled to find an example of how to tell maven publish to publish the HTML once generated. I'd also appreciate any info on that. Thanks in advance for any help...
    o
    • 2
    • 12
  • n

    Nathan Fallet

    06/15/2025, 11:47 AM
    Hello! I saw this stale PR about sitemaps in Dokka. Is there any plan about it? I would love to see the feature, and can help if needed https://github.com/Kotlin/dokka/pull/2009
    o
    • 2
    • 4
  • s

    Skolson5903

    06/23/2025, 9:59 PM
    While diagnosing a publishing issue on my KMP project, I ran a gradle publish task with --info. The project is using
    applyDefaultHierarchyTemplate()
    so all the sourceSet names fit that template. Dokka produced a number of messages that surprised me, as if it doesn't understand the default hierarchy template. I posted the messages as a reply in this thread. Basically all the source sets that aren't leaf nodes in the default template are getting labeled as common. That seems to lead to it generating doc from appleMain into all the platforms, not just the Apple ones, etc. Is this expected behavior?
    o
    a
    • 3
    • 6
  • m

    MiguelDecimal128

    07/08/2025, 2:42 PM
    I am a dokka newbie ... struggling to get dokka 2.0.0 configured in IntelliJ 2024.3.6 on macOS Setting up from scratch ... not a migration. I am following documentation at https://kotlinlang.org/docs/dokka-get-started.html https://kotlinlang.org/docs/dokka-gradle.html#single-project-configuration ... but failing ... tasks are undefined If I try the other single-project configuration then the imports are undefined. I am able and willing to help improve for other newbies coming up.
    s
    • 2
    • 8
  • k

    Kenna Zimmerman

    07/25/2025, 3:53 PM
    I’m generating HTML documentation from auto-generated java files and I’m not seeing markdown syntax being recognized. Here’s an example of the generated file:
    Copy code
    /**
     * This is a new interface for testing dokka.
     *
     * This should be a new line
     *
     * And [this](<https://www.google.com/>) should be a hyperlink.
     */
    @Keep
    public abstract class NewInterface {
        /** [This](<https://www.google.com/>) should also be a hyperlink. */
        public abstract void foo();
    And attached is the generated HTML. Neither the new lines or hyperlinks are being recognized. Am I using the right syntax? Any ideas for solutions (or workarounds)? I’m using dokka version 2.0.0
    solved 1
    e
    • 2
    • 4
  • a

    Abe Sol

    07/26/2025, 7:24 AM
    Hi 🙂 This week I configured dokka on a project. I spent like an hour tweaking Gradle trying to figure out why the side bar was empty. It turns out one needs to load the html via a web server. Double clicking on
    index.html
    leaves the side bar empty. Something that would have saved me some frustration is including a
    <!-- please load via a web server -->
    HTML comment where the list should show up.
    a
    • 2
    • 2
  • o

    oshai

    08/01/2025, 8:02 PM
    Hi, I upgraded dokka plugin to 2.0 in this commit: https://github.com/oshai/kotlin-logging/commit/c6598126edfd0c8662a736d4023975928cfdf520 it seems the docs site was generated but all links are broken (clicking a class get 404) https://oshai.github.io/kotlin-logging/
    a
    • 2
    • 6
  • r

    rnett

    08/09/2025, 11:47 PM
    Is there a way to link to other modules from module documentation? I've tried KDoc-style links to the module name (
    [my-module]
    ), relative links to the directory (
    [my-module](./my-module)
    ), and relative HTML links (
    [my-module](../my-module/index.html)
    ), none of which work. The second two are rendered as the link address rather than being links.
    👀 1
    o
    a
    • 3
    • 9
  • p

    pardom

    08/11/2025, 6:18 PM
    Has anyone faced/resolved issues with Dokka V2 multi-module Javadoc generation? The HTML generation works for my composite build dependencies, but Javadoc generation produces empty directories.
    a
    o
    • 3
    • 7
  • v

    Vojtech Hrdina

    08/19/2025, 1:22 PM
    Hi, I am working on library that is using Jetpack Compose. Is there any way on how to display components using @sample annotation in KDoc? I am getting an error “Unresolved reference ‘androidx’” in interactive preview
    z
    o
    • 3
    • 4
  • o

    Oleg Yukhnevich

    08/27/2025, 4:27 PM
    🚀 Dokka 2.1.0-Beta is out! 🚀 • Gradle plugin v2 is now enabled by default – v1 is deprecated and will be removed in future releases! • K2 analysis is enabled by default – now with the support for context parameters! • Refined HTML output with improved accessibility & UI. • Performance improvements and bug fixes. We would really appreciate your feedback! kodee loving
    🔥 5
    dokkatoo intensifies 1
    j
    a
    • 3
    • 2