Hi, `Is this possible to add multiple md files vi...
# dokka
k
Hi,
Is this possible to add multiple md files via dokka configurations?
For example in this repo: https://github.com/Kotlin/dokka/blob/1.9.10/examples/gradle/dokka-gradle-example/build.gradle.kts We have only
Module.md
file. So in the gradle, we have added below line:
Copy code
moduleName.set("Dokka Gradle Example")
includes.from("Module.md")
But what if we have one more Module1.md file to show the different content? I tried below code it works actually, I can see content of the 2 different md files
Copy code
includes.from("Module.md", "Module.md")
but is there any way where we can have these 2 file separates? Can someone have face this kind of issues before to show multiple md files in the project?
c
In all my projects, I use a Markdown file for each module, for example: https://gitlab.com/opensavvy/pedestal I'm not completely sure I understand the question, though.
k
Thanks for sharing, I am checking this now.
c
The dokka config is here: https://gitlab.com/opensavvy/automation/gradle-conventions/-/blob/main/kotlin/src/main/kotlin/abstractLibrary.gradle.kts#L25-L39 (it's dokkatoo, but that part of the config is basically the same)
k
Looks like you have only 1 md file
c
One per source set per module. Each module has its own. When there are multiple source sets, there are multiple files: https://gitlab.com/opensavvy/pedestal/-/tree/main/logger?ref_type=heads Again, I'm not sure I understand what you want
k
What if you have 2 readme files in the same package. In the real world example: I have multiple md files, like 1 is ReadMe, one is Getting Started, another one is for PushNotifications in a single module.
c
Is the project public? Do you have a link for these files?
k
No it is not a public project and that is under development. But you can see this example: https://github.com/Kotlin/dokka/tree/1.9.10/examples/gradle/dokka-gradle-example In this, we can see Module.md but what if we have GettingStarted.md file is there and we want to see both the files while running the dokkaHtml command.
c
You can add as many files you want as long as they follow this structure: https://kotlinlang.org/docs/dokka-module-and-package-docs.html#file-format
k
All the module file content I can see into 1 file.
you can see here I have created 2 files module.md and module1.md and I also have added -> includes.from("Module.md", "Module1.md") I can see these 2 files content but it looks wired. I need 2 separate files. So it is easy for users to understand.
c
What do you expect to happen? Both files are documentation for the same module, so one of them will shadow the other.
k
I am expecting this kind of structure if that is possible using dokka?
c
Do you want child pages? If you want sections in a single page, you can do:
Copy code
# Module MODULE_NAME

## Gradle

## Maven
in a single file If you want child pages, they can only be created for packages. If you want child pages that correspond to no code at all, you can create an issue: https://github.com/Kotlin/dokka/issues
k
I want two different files not a single file with single page informations. Sure I will create a ticket for this. Thank you so much.
w
It sounds like you're wandering a little bit outside of dokka's intended use case. Dokka is intended for API documentation where there is essentially a 1 to 1 relationship between bits of documentation and API elements (modules, packages, classes, functions, etc). It sounds like the documentation you're trying to include isn't really API level documentation. I had a similar conversation in this channel not long ago (https://kotlinlang.slack.com/archives/C0F4UNJET/p1704997886940409) and MkDocs was recommended to me. I started using that for my higher level documentation and linking to API elements in the Dokka output where appropriate. It's a much nicer result that I ever would have ended up with trying to stick with just dokka.
c
Hey @Wesley Hartford, is your project public? I'd like to look at your setup
w
Sorry, mine is not. I'm happy to answer some questions though. In the thread I linked to, @Oleg Yukhnevich provided a few links to some of his work using the same tool.
o
Yeah Here is the
mkdocs.yaml
configuration - https://github.com/whyoleg/cryptography-kotlin/blob/main/mkdocs.yml You can also search for
mkdocs
in a project, for the related logic
c
Thanks, I'll look into it
s
@KV unsure if you solved your problem or not, but it seems like it wasn't fully solved, but here's something I did in one of my projects which is kind of similar: • kt-fuzzy.dokka.gradle.kts: configures the following ◦ custom styles (built from scss sources) ◦ custom scripts ◦ a templated "including" section that will inject a tabbed widget listing the different methods of including it as a dependency ◦ some stuff for references/footnotes • _including.md: the template injected for depending on the project • dokka/includes: the directory with the docs I think you're looking for something like what I did with the tabbed widget, for inclusion as a dependency the result looks like this:
k
Yes, thank you for sharing, let me try to implement this ^
131 Views