From a816e917995858129ad074409f73e99d3b100318 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Mon, 26 Sep 2022 16:33:24 +0300 Subject: Trim four spaces inside indented code block (#2661) * Trim four spaces inside indented code block * Fix test --- plugins/base/src/test/kotlin/model/CommentTest.kt | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'plugins/base/src/test/kotlin/model') diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index 0742587a..c511a3de 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -1,6 +1,8 @@ package model +import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.DProperty +import org.jetbrains.dokka.model.doc.CodeBlock import org.jetbrains.dokka.model.doc.CustomTagWrapper import org.jetbrains.dokka.model.doc.Text import org.junit.jupiter.api.Test @@ -267,4 +269,39 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme } } } + + @Test + fun `should remove spaces inside indented code block`() { + inlineModelTest( + """ + |/** + | * Welcome: + | * + | * ```kotlin + | * fun main() { + | * println("Hello World!") + | * } + | * ``` + | * + | * fun thisIsACodeBlock() { + | * val butWhy = "per markdown spec, because four-spaces prefix" + | * } + | */ + |class Foo + """ + ) { + with((this / "comment" / "Foo").cast()) { + docs()[0].children[2] equals CodeBlock( + listOf( + Text( + "fun thisIsACodeBlock() {\n" + + " val butWhy = \"per markdown spec, because four-spaces prefix\"\n" + + "}" + ) + ) + ) + } + } + } + } -- cgit