Dokka: Material for MkDocs format
Gradle plugin to configure Dokka 2+ with Material for MkDocs.
This is a Gradle plugin using Dokka to extract Kotlin documentation and embed it in a Material for MkDocs site. To learn more about the project, see the documentation.
Configuration
Create a build.gradle.kts file in the same directory as your mkdocs.yml file:
id("dev.opensavvy.dokka-mkdocs") version "VERSION HERE"
dependencies {
// Embeds the documentation from project :foo-bar
dokka(project("foo-bar"))
}Content copied to clipboard
Add each project that you want to document in the dependencies {} block. Each project mentioned in that way must have the Dokka plugin applied.
Add the directory in which you created the project in the settings.gradle.kts file:
// Everything else…
include("docs") // or whatever other path you usedContent copied to clipboard
In mkdocs.yml, add the marker of where you want the documentation to be generated:
# Everything else…
nav:
- Home: # your existing pages…
- index.md
- setup.md
- Another: another.md # your existing pages…
# !!! EMBEDDED DOKKA START, DO NOT COMMIT !!! #
# !!! EMBEDDED DOKKA END, DO NOT COMMIT !!! #
- Whatever: whatever.md # your existing pages…Content copied to clipboard
Running
Run the following command, replacing docs by the project path of where you put your documentation:
./gradlew docs:embedDokkaIntoMkDocsContent copied to clipboard