From 4f4b86b873b7676979d3258030fdfc382e22a06b Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 16 May 2017 20:44:28 +0300 Subject: Fix invalid line breaks in table cells for markdown formats #KT-16234 fixed --- core/src/main/kotlin/Formats/MarkdownFormatService.kt | 6 +++++- core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt index f7c17401..a7c18a28 100644 --- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt +++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt @@ -87,7 +87,11 @@ open class MarkdownOutputBuilder(to: StringBuilder, maxBackticksInCodeBlock = maxBackticksInCodeBlock.coerceAtLeast(longestBackTickRun) } else { - to.append(text.htmlEscape()) + if (text == "\n" && inTableCell) { + to.append(" ") + } else { + to.append(text.htmlEscape()) + } } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index 52a62656..e3f4bae7 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -364,6 +364,10 @@ class MarkdownFormatTest { verifyMarkdownNode("nestedLists") } + @Test fun newlineInTableCell() { + verifyMarkdownPackage("newlineInTableCell") + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true) -- cgit