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

Module.md - Kotlin code sample with annotation fails #1838

Closed
hfhbd opened this issue Apr 11, 2021 · 1 comment · Fixed by #2418
Closed

Module.md - Kotlin code sample with annotation fails #1838

hfhbd opened this issue Apr 11, 2021 · 1 comment · Fixed by #2418
Labels

Comments

@hfhbd
Copy link
Contributor

hfhbd commented Apr 11, 2021

Describe the bug
If a code sample inside the Module.md contains an annotation, like @ExperimentalTime this sample and all following content is missing.

I checked out the sample code from https://github.com/Kotlin/kotlin-examples/tree/master/gradle/dokka/dokka-gradle-example/src/main/kotlin.

Expected behaviour
Code sample containing the annotation

Screenshots
Bildschirmfoto 2021-04-12 um 00 42 08

To Reproduce

# Module Dokka Gradle Example

This is an example of how you can write module documentation with Dokka.

## Testing Kotlin code

Sample 1/2

````kotlin
fun sample1() {

}
Sample 2/2

````kotlin
@ExperimentalTime
fun sample2() {

}
# Package demo

This package contains a few examples of Dokka usage.

Dokka configuration
Configuration of dokka used to reproduce the bug

import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URL

plugins {
    kotlin("jvm") version "1.4.32"
    id("org.jetbrains.dokka") version ("1.4.30")
}

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    testImplementation(kotlin("test-junit"))
}

tasks.withType<DokkaTask>().configureEach {
    dokkaSourceSets {
        configureEach {
            moduleName.set("Dokka Gradle Example")
            includes.from("Module.md")
            val sourceSetName = name
            println(sourceSetName)
            sourceLink {
                localDirectory.set(file("src/$sourceSetName/kotlin"))
                remoteUrl.set(URL("https://github.com/Kotlin/kotlin-examples/tree/master/" +
                        "gradle/dokka/dokka-gradle-example/src/main/kotlin"
                ))
                remoteLineSuffix.set("#L")
            }
        }
    }
}

Installation

  • Operating system: macOS 11
  • Build tool: Gradle v7.0
  • Dokka version: 1.4.30
@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Apr 11, 2022

Partially fixed in the upcoming 1.6.20. The fix will solve the majority of problems, although some corner cases may still arise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants