diff options
-rw-r--r-- | core/src/main/kotlin/Kotlin/ContentBuilder.kt | 5 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/exclInCodeBlock.kt | 5 | ||||
-rw-r--r-- | core/testdata/format/exclInCodeBlock.md | 8 |
4 files changed, 21 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/ContentBuilder.kt b/core/src/main/kotlin/Kotlin/ContentBuilder.kt index 9e89a20a..c16b19c5 100644 --- a/core/src/main/kotlin/Kotlin/ContentBuilder.kt +++ b/core/src/main/kotlin/Kotlin/ContentBuilder.kt @@ -42,7 +42,9 @@ fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver: (Stri MarkdownElementTypes.LIST_ITEM -> appendNodeWithChildren(ContentListItem()) MarkdownElementTypes.EMPH -> appendNodeWithChildren(ContentEmphasis()) MarkdownElementTypes.STRONG -> appendNodeWithChildren(ContentStrong()) - MarkdownElementTypes.CODE_SPAN -> appendNodeWithChildren(ContentCode()) + MarkdownElementTypes.CODE_SPAN -> { + appendNodeWithChildren(ContentCode()) + } MarkdownElementTypes.CODE_BLOCK, MarkdownElementTypes.CODE_FENCE -> appendNodeWithChildren(ContentBlockCode()) MarkdownElementTypes.PARAGRAPH -> appendNodeWithChildren(ContentParagraph()) @@ -123,6 +125,7 @@ fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver: (Stri MarkdownTokenTypes.RPAREN, MarkdownTokenTypes.LBRACKET, MarkdownTokenTypes.RBRACKET, + MarkdownTokenTypes.EXCLAMATION_MARK, MarkdownTokenTypes.CODE_FENCE_CONTENT -> { parent.append(ContentText(node.text)) } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index cad1977d..00bbdd61 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -210,6 +210,10 @@ class MarkdownFormatTest { verifyMarkdownNode("codeBlock") } + @Test fun exclInCodeBlock() { + verifyMarkdownNodeByName("exclInCodeBlock", "foo") + } + private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) { verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output -> markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members) diff --git a/core/testdata/format/exclInCodeBlock.kt b/core/testdata/format/exclInCodeBlock.kt new file mode 100644 index 00000000..62b234dd --- /dev/null +++ b/core/testdata/format/exclInCodeBlock.kt @@ -0,0 +1,5 @@ +/** + * The magic word is `!` + */ +fun foo() { +} diff --git a/core/testdata/format/exclInCodeBlock.md b/core/testdata/format/exclInCodeBlock.md new file mode 100644 index 00000000..9c9e424a --- /dev/null +++ b/core/testdata/format/exclInCodeBlock.md @@ -0,0 +1,8 @@ +[test](test/index) / [foo](test/foo) + +# foo + +`fun foo(): Unit` + +The magic word is `!` + |