From d3f0e03284999e6f7fac99a345ed91cb63503706 Mon Sep 17 00:00:00 2001 From: Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> Date: Mon, 4 Jan 2021 12:59:03 +0100 Subject: Refactor ContentTable builder and fix GFM table rendering (#1682) --- .../org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins/gfm/src/main/kotlin') 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) = append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.name }) -} \ No newline at end of file +} -- cgit