aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/Kotlin')
-rw-r--r--core/src/main/kotlin/Kotlin/ContentBuilder.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/ContentBuilder.kt b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
index c16b19c5..7bee6936 100644
--- a/core/src/main/kotlin/Kotlin/ContentBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
@@ -43,7 +43,12 @@ fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver: (Stri
MarkdownElementTypes.EMPH -> appendNodeWithChildren(ContentEmphasis())
MarkdownElementTypes.STRONG -> appendNodeWithChildren(ContentStrong())
MarkdownElementTypes.CODE_SPAN -> {
- appendNodeWithChildren(ContentCode())
+ val startDelimiter = node.child(MarkdownTokenTypes.BACKTICK)?.text
+ if (startDelimiter != null) {
+ val text = node.text.substring(startDelimiter.length).removeSuffix(startDelimiter)
+ val codeSpan = ContentCode().apply { append(ContentText(text)) }
+ parent.append(codeSpan)
+ }
}
MarkdownElementTypes.CODE_BLOCK,
MarkdownElementTypes.CODE_FENCE -> appendNodeWithChildren(ContentBlockCode())
@@ -126,6 +131,7 @@ fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver: (Stri
MarkdownTokenTypes.LBRACKET,
MarkdownTokenTypes.RBRACKET,
MarkdownTokenTypes.EXCLAMATION_MARK,
+ MarkdownTokenTypes.BACKTICK,
MarkdownTokenTypes.CODE_FENCE_CONTENT -> {
parent.append(ContentText(node.text))
}