dokka icon indicating copy to clipboard operation
dokka copied to clipboard

[Dokka 2] Table header rendered as empty

Open MGaetan89 opened this issue 1 year ago • 5 comments

Describe the bug

If I use a table in my documentation (both code documentation and included files), the header is displayed as empty.

Expected behaviour

The header of the table is displayed.

Screenshots

Screenshot 2024-11-05 at 11 14 39 Screenshot 2024-11-05 at 11 15 14

To Reproduce

The screenshots above were generated with the following documentation:

/**
 * | Column A | Column B | Column C |
 * |-----|-----|-----|
 * | Cell 1 | Cell 2 | Cell 3 |
 * | Cell 4 | Cell 5 | Cell 6 |
 */

Installation

  • Operating system: macOS 15.1
  • Build tool: Gradle v8.10.2
  • Dokka version: 2.0.0-Beta

Dokka configuration

https://github.com/SRGSSR/pillarbox-android/blob/4a3ae5e3df1dc7ba041e1f91ad3164e3d022ff28/build.gradle.kts#L20-L37

https://github.com/SRGSSR/pillarbox-android/blob/4a3ae5e3df1dc7ba041e1f91ad3164e3d022ff28/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt#L89-L114

MGaetan89 avatar Nov 05 '24 10:11 MGaetan89

Hi, could you provide the full code block you're using? I've tried it quickly and with the following code:

/**
 * | Column A | Column B | Column C |
 * |-----|-----|-----|
 * | Cell 1 | Cell 2 | Cell 3 |
 * | Cell 4 | Cell 5 | Cell 6 |
 */
val asd = ""
image

So, I wonder if there's something specific about how the KDoc is declared that is causing the issue. I see an enum in your screenshot, maybe that's related

adam-enko avatar Nov 05 '24 14:11 adam-enko

That was the whole KDoc. I just tried on an interface, a field and a method: Screenshot 2024-11-05 at 16 00 44

With the same result: Screenshot 2024-11-05 at 15 58 56

Screenshot 2024-11-05 at 15 59 04 Screenshot 2024-11-05 at 15 59 12

I've added my Dokka configuration in my first message, in case it helps.

MGaetan89 avatar Nov 05 '24 15:11 MGaetan89

Hey! I also can't reproduce the original issue, and always see table header, no matter where I will put it. If it's reproduced in your project, could you please share the link to the class where it could be reproduced or as a separate GitHub project?

whyoleg avatar Nov 14 '24 13:11 whyoleg

You can check out the following project: https://github.com/SRGSSR/pillarbox-android on the dokka_table_demo branch.

I've added a table in the PillarboxPlayer interface.

If you run ./gradlew :dokkaGenerate and open this page, you'll see that the table doesn't have any header.


The global Dokka configuration is available here: https://github.com/SRGSSR/pillarbox-android/blob/b69923e324f941c2380f799d6101e77cc5e07654/build.gradle.kts#L20-L45

And we have a Gradle plugin for per-module configuration: https://github.com/SRGSSR/pillarbox-android/blob/b69923e324f941c2380f799d6101e77cc5e07654/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt#L89-L130


Let me know if you need help to set up the project, or to reproduce the issue.

MGaetan89 avatar Nov 14 '24 15:11 MGaetan89

I'm encountering this too (in my androidx-ktx-extras project), and this seems to happen when I tried to update my binary library publishing plugin to accommodate for JVM libraries.

Previously, I was suppressing all source-sets except for the main source-set, which seems to work (as can be seen here):

dokkaSourceSets {
    configureEach {
        suppress.set(true)
    }
    named("main") {
        suppress.set(false)
    }
}

(From LibraryPlugin.kt; Module.md is then added from lines 359 to 365)

Current enum variants section in browser-ktx Dokka docs

(The Markdown file for the doc above)

After removing that block above, this results in the table headers being absent:

Enum variants section after removing suppression, where the headers are absent

I've noticed that @MGaetan89's project is an Android project, so perhaps this issue might be specific to Android projects?

I then did some digging into the resulting dokka-configuration.json, and found that the config has a "debug" and "release" source-set as well, resulting in 3 separate source-sets:

build/tmp/dokkaGeneratePublicationHtml/dokka-configuration.json:

{
  // ...
  "sourceSets": [
    {
      "displayName": "androidJvm",
      "sourceSetID": {
        "scopeId": ":androidx:recyclerview:recyclerview-ktx",
        "sourceSetName": "debug"
      },
      // ...
      "includes": [
         "<truncated>/recyclerview-ktx/Module.md"
      ]
    },
    {
      "displayName": "androidJvm",
      "sourceSetID": {
        "scopeId": ":androidx:recyclerview:recyclerview-ktx",
        "sourceSetName": "main"
      },
      // ...
      "includes": [
         "<truncated>/recyclerview-ktx/Module.md"
      ]
    },
    {
      "displayName": "androidJvm",
      "sourceSetID": {
        "scopeId": ":androidx:recyclerview:recyclerview-ktx",
        "sourceSetName": "release"
      },
      // ...
      "includes": [
         "<truncated>/recyclerview-ktx/Module.md"
      ]
    }
  ]
}

Does Dokka perhaps expect only a single Android source-set for it to work?

EdricChan03 avatar Mar 17 '25 08:03 EdricChan03