<#C0F4UNJET|dokka> Question I'm using Dokka to ge...
# dokka
a
#dokka Question I'm using Dokka to generate Kotlin documentation for a single module. I'd like to display a different name on my index page instead of the module name. When I pass the actual module name via the 'moduleName' field, it displays fine, and the additional markdown files that I add using the 'includes.from' option also display correctly in HTML. However, when I pass a different name that I want to display on the index page via the 'moduleName' field, it doesn't load the files from 'includes'. How can I set a different name to display on the index page ?
Copy code
tasks.withType(DokkaTask.class).configureEach {
    dokkaSourceSets {
        named("main") {
            moduleName.set("mkplayer")
            moduleVersion.set("$mkplayer_version")
            includes.from("../docsDokka/src/mkplayersdk.md")
            outputDirectory.set(file("../docsDokka/src/tempOutput/html"))
        }
    }

    String dokkaBaseConfiguration = """
    {
        "footerMessage": "(c) Player SDK for Android. All rights reserved."
    }
    """
    pluginsMapConfiguration.set(
        ["org.jetbrains.dokka.base.DokkaBase": dokkaBaseConfiguration]
    )
}
Installation • Operating system: macOS • Build tool: Gradle v8.3.0 • Dokka version: 1.9.10 Screenshots when moduleName is same, data from 'playersdk.md' is shown moduleName.set("mkplayer") when moduleName is different, data from 'playersdk.md' is not shown moduleName.set("Player SDK for Android")
c
If I understand correctly, the
moduleName
should be exactly what you use in the
# Module <moduleName>
at the top of the markdown file. For example, here I wanted to have a complex name, so the markdown file follows the same name. However, I'm using Dokkatoo and not Dokka directly so I'm not 100% sure it's the same thing.
a
Hi @CLOVIS, thanks for your reply. If you check out these Gradle docs (link), you'll notice they have a different header name than the module name. Any ideas on how we can achieve this? Or is there an option to hide the module name?
c
What do you call a header name?
a
When I mentioned "header name," I was referring to the displayed name, which differs from the module name. In above case, the module name appears as only
Gradle
(visible in the sidebar), while the displayed name is
Kotlin DSL Reference for Gradle
.
c
Ah. Sorry, no, I don't know how to do that. As you can see in my example though, you can customize the module name and still have the markdown file show correctly.
a
Thanks for your kind inputs 🙂
o
Hey, sorry for delay Unfortunately, on current moment it's not possible to use different name for modules (in navigation page), header and so on Here is what Gradle is doing here to achieve this (may be this will be helpful for your use case): 1.
Kotlin DSL Reference for Gradle
on page (on the right side) comes from
Module.md
(source) + they hide original module name via
css
styles (source) 2.
Kotlin DSL Reference for Gradle
in header comes from 'a little hack' in CSS where they prefix header name with additional text (source) - most likely it's possible to fully replace text in header in the same way