diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-06-19 17:29:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-19 17:29:45 +0200 |
commit | a11a8dd92fcccff770d6893f27c3546fef17655d (patch) | |
tree | ada6954c06a5050e1b4785c39e279bcc60053bf0 /plugins/gfm/src/test | |
parent | 9f67dcf75d3b86fa6e4e352d2cebc4f9e17b8048 (diff) | |
download | dokka-a11a8dd92fcccff770d6893f27c3546fef17655d.tar.gz dokka-a11a8dd92fcccff770d6893f27c3546fef17655d.tar.bz2 dokka-a11a8dd92fcccff770d6893f27c3546fef17655d.zip |
Dont escape text inside gfm code blocks (#2541)
Diffstat (limited to 'plugins/gfm/src/test')
-rw-r--r-- | plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt index ce0c3d0c..a8b263eb 100644 --- a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt +++ b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt @@ -25,14 +25,32 @@ class CodeWrappingTest : GfmRenderingOnlyTestBase() { } @Test + fun `should preserve original text without escaping`() { + val page = testPage { + codeBlock { + text("<----> **text** & ~~this~~ and \"that\"") + } + } + val expect = """|//[testPage](test-page.md) + | + |```kotlin + |<----> **text** & ~~this~~ and "that" + |```""".trimMargin() + + CommonmarkRenderer(context).render(page) + assertEquals(expect, renderedContent) + } + + + @Test fun wrappedInlineCode() { val page = testPage { text("This function adds the values of ") - codeInline("") { + codeInline { text("left") } text(" and ") - codeInline("") { + codeInline { text("right") } text(".\nBoth numbers must be finite, or an exception occurs.\n") @@ -45,4 +63,21 @@ class CodeWrappingTest : GfmRenderingOnlyTestBase() { CommonmarkRenderer(context).render(page) assertEquals(expect, renderedContent) } + + @Test + fun `should not add trailing backslash to newline elements for code inline code`() { + val page = testPage { + text("This adds some symbols (") + codeInline { + text("<----> **text** & ~~this~~ and \"that\"") + } + text(") to the test") + } + val expect = """|//[testPage](test-page.md) + | + |This adds some symbols (`<----> **text** & ~~this~~ and "that"`) to the test""".trimMargin() + + CommonmarkRenderer(context).render(page) + assertEquals(expect, renderedContent) + } } |