diff options
-rw-r--r-- | src/Kotlin/ContentBuilder.kt | 7 | ||||
-rw-r--r-- | test/data/format/codeSpan.html | 13 | ||||
-rw-r--r-- | test/data/format/codeSpan.kt | 4 | ||||
-rw-r--r-- | test/src/format/HtmlFormatTest.kt | 6 |
4 files changed, 29 insertions, 1 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index b5647ff0..80d49a85 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -49,11 +49,16 @@ public fun DocumentationBuilder.buildContentTo(tree: MarkdownNode, target: Conte processChildren() parent.append(nodeStack.pop()) } - MarkdownTokenTypes.CODE -> { + MarkdownElementTypes.CODE_SPAN -> { nodeStack.push(ContentCode()) processChildren() parent.append(nodeStack.pop()) } + MarkdownElementTypes.CODE_BLOCK -> { + nodeStack.push(ContentBlockCode()) + processChildren() + parent.append(nodeStack.pop()) + } MarkdownElementTypes.INLINE_LINK -> { val label = node.child(MarkdownElementTypes.LINK_TEXT)?.child(MarkdownTokenTypes.TEXT) val destination = node.child(MarkdownElementTypes.LINK_DESTINATION) diff --git a/test/data/format/codeSpan.html b/test/data/format/codeSpan.html new file mode 100644 index 00000000..37bb62f0 --- /dev/null +++ b/test/data/format/codeSpan.html @@ -0,0 +1,13 @@ +<HTML> +<HEAD> +<title>test / foo</title> +</HEAD> +<BODY> +<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">foo</a><br/> +<br/> +<h1>foo</h1> +<pre><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></pre><p>This is a <code>code span</code>.</p> +<br/> +<br/> +</BODY> +</HTML> diff --git a/test/data/format/codeSpan.kt b/test/data/format/codeSpan.kt new file mode 100644 index 00000000..645f454a --- /dev/null +++ b/test/data/format/codeSpan.kt @@ -0,0 +1,4 @@ +/** + * This is a `code span`. + */ +fun foo() {}
\ No newline at end of file diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt index dfecb4d4..0170d148 100644 --- a/test/src/format/HtmlFormatTest.kt +++ b/test/src/format/HtmlFormatTest.kt @@ -39,4 +39,10 @@ public class HtmlFormatTest { htmlService.appendNodes(tempLocation, output, model.members.single().members) } } + + Test fun codeSpan() { + verifyOutput("test/data/format/codeSpan.kt", ".html") { model, output -> + htmlService.appendNodes(tempLocation, output, model.members.single().members) + } + } } |