aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Kotlin/ContentBuilder.kt9
-rw-r--r--core/src/test/kotlin/format/HtmlFormatTest.kt4
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt4
3 files changed, 14 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Kotlin/ContentBuilder.kt b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
index 771bc44b..c60625a4 100644
--- a/core/src/main/kotlin/Kotlin/ContentBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
@@ -110,9 +110,12 @@ fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver: LinkR
}
MarkdownTokenTypes.CODE_LINE -> {
- val block = ContentBlockCode()
- block.append(ContentText(node.text))
- parent.append(block)
+ val content = ContentText(node.text)
+ if (parent is ContentBlockCode) {
+ parent.append(content)
+ } else {
+ parent.append(ContentBlockCode().apply { append(content) })
+ }
}
MarkdownTokenTypes.TEXT -> {
diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt
index 4fe4f6ab..01e4559e 100644
--- a/core/src/test/kotlin/format/HtmlFormatTest.kt
+++ b/core/src/test/kotlin/format/HtmlFormatTest.kt
@@ -146,6 +146,10 @@ class HtmlFormatTest {
verifyHtmlNode("blankLineInsideCodeBlock")
}
+ @Test fun indentedCodeBlock() {
+ verifyHtmlNode("indentedCodeBlock")
+ }
+
private fun verifyHtmlNode(fileName: String, withKotlinRuntime: Boolean = false) {
verifyHtmlNodes(fileName, withKotlinRuntime) { model -> model.members.single().members }
}
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index 48b06d6e..fbebfbfd 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -376,6 +376,10 @@ class MarkdownFormatTest {
verifyMarkdownPackage("newlineInTableCell")
}
+ @Test fun indentedCodeBlock() {
+ verifyMarkdownNode("indentedCodeBlock")
+ }
+
private fun buildMultiplePlatforms(path: String): DocumentationModule {
val module = DocumentationModule("test")
val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true)