diff --git a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt
index ed60be75ebc..ebea243f86d 100644
--- a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt
@@ -154,7 +154,13 @@ object KDocRenderer {
sb.trimEnd()
wrapChildren("p", newline = true)
}
- MarkdownElementTypes.CODE_SPAN -> wrapChildren("code")
+ MarkdownElementTypes.CODE_SPAN -> {
+ val startDelimiter = node.child(MarkdownTokenTypes.BACKTICK)?.text
+ if (startDelimiter != null) {
+ val text = node.text.substring(startDelimiter.length).removeSuffix(startDelimiter)
+ sb.append("").append(text.htmlEscape()).append("")
+ }
+ }
MarkdownElementTypes.CODE_BLOCK,
MarkdownElementTypes.CODE_FENCE -> {
sb.trimEnd()
diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt
index dae621b13af..dc51d2f542a 100644
--- a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt
+++ b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt
@@ -12,6 +12,9 @@
* Single stars embedded in a word like Embedded*Star have to be preserved as well.
*
* Exclamation marks are also important! Also in `code blocks!`
+ *
+ * bt+ : ``prefix ` postfix``
+ * backslash: `\`
*/
fun testMethod() {
@@ -30,3 +33,4 @@ fun test() {
//INFO:
This is emphasized text but text_with_underscores has to preserve the underscores. Single stars embedded in a word like Embedded*Star have to be preserved as well.
//INFO:Exclamation marks are also important! Also in code blocks!
bt+ : prefix ` postfix backslash: \