How can I suppress Dokka documentation for specific classes?

2.1k views Asked by At

I'm trying to generate nice API docs for a library I'm working on, and I haven't found a way to keep Dokka from generating empty documentation pages for generated code like the R class in my package.

I'm already using

packageOptions {
  prefix = "android"
  suppress = true
}

to suppress documentation at a package level, but is there a way to prevent generation of documentation for specific classes in the package I do want to generate documentation for? Or build a whitelist of classes so Dokka only generates docs for those classes?

Or is there another doc generator for Kotlin that I should look into?

2

There are 2 answers

0
Greg On BEST ANSWER

It looks like you can specify class names as well as prefixes in the packageOptions section. You just specify them the same as you would a prefix.

packageOptions {
  prefix = "com.fqdn.MyPackage.R"
  suppress = true
}
0
Duna On

One option is to set the desired classes as internal. Doing so, the documentation will not be generated for internal ones. Also useful to configure in gradle file dokka like this:

    named("main"){
        //sourceRoots.setFrom(file("src/main/java/com/cujo/sb/util"))
        includeNonPublic.set(false)
        skipEmptyPackages.set(true)
        reportUndocumented.set(true)
        skipDeprecated.set(false)
    }