Hannes Hertach
Hannes Hertach

Reputation: 529

KDoc / Dokka: Ignore inherited methods in subclass

I am generating documentation using KDoc/Dokka for an android library.

I have a custom view, which extends LinearLayout.

The problem is that LinearLayout contains hundreds of public methods. Dokka generates empty documentation for all of these methods, even though I did not use or override them in my own code.

This completely buries any of my own methods and makes the documentation near useless.

How can I prevent dokka from generating documentation for inherited methods?

Upvotes: 2

Views: 1464

Answers (2)

Ignacio Crespo
Ignacio Crespo

Reputation: 1

From the answer by @andrzej-ratajczak the following can be used

pluginsMapConfiguration.set(
  ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)

here an example of my own module

dokkaHtml {
    moduleName = "${project.name}"

    dokkaSourceSets {
        configureEach {
            // Suppress a package
            perPackageOption {
                // will match all packages and sub-packages
                matchingRegex.set(".*\\.internal.*")
                suppress.set(true)
            }

            // separate inherited members to avoid polluting our public API
            // https://github.com/Kotlin/dokka/issues/1501
            pluginsMapConfiguration.set(
                    ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
            )

        }
    }
}

Upvotes: 0

Andrzej Ratajczak
Andrzej Ratajczak

Reputation: 66

Currently this is not supported, probably we will add some flag to turn it on/off.

You can follow this issue: https://github.com/Kotlin/dokka/issues/1501

Upvotes: 2

Related Questions