diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-01-04 12:59:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 12:59:03 +0100 |
commit | d3f0e03284999e6f7fac99a345ed91cb63503706 (patch) | |
tree | 0becbb39444fbf7ee9300adc1fb6b04861ec54f6 /plugins/gfm/src/main/kotlin | |
parent | 6b0cdf3102b1f1dd213ca0c2e2c333f8756be6b4 (diff) | |
download | dokka-d3f0e03284999e6f7fac99a345ed91cb63503706.tar.gz dokka-d3f0e03284999e6f7fac99a345ed91cb63503706.tar.bz2 dokka-d3f0e03284999e6f7fac99a345ed91cb63503706.zip |
Refactor ContentTable builder and fix GFM table rendering (#1682)
Diffstat (limited to 'plugins/gfm/src/main/kotlin')
-rw-r--r-- | plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt index 9fb92272..67552946 100644 --- a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt @@ -163,18 +163,18 @@ open class CommonmarkRenderer( buildNewLine() } } else { - val size = node.header.size + val size = node.header.firstOrNull()?.children?.size ?: node.children.firstOrNull()?.children?.size ?: 0 if (node.header.isNotEmpty()) { - append("| ") node.header.forEach { + append("| ") it.children.forEach { append(" ") it.build(this, pageContext, it.sourceSets) + append(" | ") } - append("| ") + append("\n") } - append("\n") } else { append("| ".repeat(size)) if (size > 0) append("|\n") @@ -196,7 +196,7 @@ open class CommonmarkRenderer( ) // Workaround for headers inside tables } append(builder.toString().withEntersAsHtml()) - append(" | ".repeat(size - it.children.size)) + append("|".repeat(size + 1 - it.children.size)) append("\n") } } @@ -339,4 +339,4 @@ open class CommonmarkRenderer( private fun StringBuilder.buildSourceSetTags(sourceSets: Set<DisplaySourceSet>) = append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.name }) -}
\ No newline at end of file +} |