Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate README.md instead of index.md #333

Open
msink opened this issue Jul 16, 2018 · 4 comments
Open

Generate README.md instead of index.md #333

msink opened this issue Jul 16, 2018 · 4 comments
Labels
enhancement An issue for a feature or an overall improvement format: gfm An issue/PR related to Dokka's GFM output format

Comments

@msink
Copy link
Contributor

msink commented Jul 16, 2018

Is it possible to generate README.md instead of index.md for each class, in github flavored markdown mode?

@semoro
Copy link
Contributor

semoro commented Jul 16, 2018

Right now it is not supported

@semoro semoro added enhancement An issue for a feature or an overall improvement question A user question, can be resolved if the question is answered/resolved labels Jul 16, 2018
@joserobjr
Copy link

joserobjr commented May 27, 2019

This will do it:

task dokkaKdoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
    outputFormat = 'gfm'
    outputDirectory = "$buildDir/kdoc"
}

import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
task createReadmeFiles(dependsOn: dokkaKdoc) {
    doFirst {
        Files.walk(Paths.get(dokkaKdoc.outputDirectory))
                .filter { it.getFileName().toString().toLowerCase() == "index.md" }
                .forEach {
                    try {
                        Files.copy(it, it.resolveSibling("README.md"), StandardCopyOption.REPLACE_EXISTING)
                    } catch (e) {
                        throw new RuntimeException(e)
                    }
                }
    }
}

Just call createReadmeFiles instead of dokkaKdoc

@Kordyjan Kordyjan modified the milestones: Post-Stable, 0.11.0 Sep 1, 2020
@atulgpt
Copy link

atulgpt commented Nov 3, 2021

@semoro/ @msink will this feature be supported in a future release?

@IgnatBeresnev IgnatBeresnev added format: gfm An issue/PR related to Dokka's GFM output format and removed question A user question, can be resolved if the question is answered/resolved plugin idea labels Mar 14, 2023
@IgnatBeresnev IgnatBeresnev removed this from the Backlog milestone Aug 22, 2023
@tonisives
Copy link

You can register this task that renames index.md to README.md after dokkaGfm finishes

build.gradle.kts

dokkaGfm {
    outputDirectory.set(file("$rootDir/docs/"))
}

tasks.register('renameDokkaReadme') {
    doLast {
        file("$rootDir/docs/index.md").renameTo("$rootDir/docs/README.md")
    }
}

tasks.dokkaGfm.finalizedBy renameDokkaReadme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement format: gfm An issue/PR related to Dokka's GFM output format
Projects
None yet
Development

No branches or pull requests

7 participants