diff --git a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt index 14e34911068..f752440ac98 100644 --- a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt @@ -161,7 +161,7 @@ object KDocRenderer { MarkdownElementTypes.FULL_REFERENCE_LINK -> { val label = node.child(MarkdownElementTypes.LINK_LABEL)?.child(MarkdownTokenTypes.TEXT)?.text if (label != null) { - val linkText = node.child(MarkdownElementTypes.LINK_TEXT)?.child(MarkdownTokenTypes.TEXT)?.text ?: label + val linkText = node.child(MarkdownElementTypes.LINK_TEXT)?.toHtml() ?: label DocumentationManagerUtil.createHyperlink(sb, label, linkText, true) } else { @@ -169,10 +169,10 @@ object KDocRenderer { } } MarkdownElementTypes.INLINE_LINK -> { - val label = node.child(MarkdownElementTypes.LINK_TEXT)?.child(MarkdownTokenTypes.TEXT)?.text + val label = node.child(MarkdownElementTypes.LINK_TEXT)?.toHtml() val destination = node.child(MarkdownElementTypes.LINK_DESTINATION)?.text if (label != null && destination != null) { - sb.append("${label.htmlEscape()}") + sb.append("$label") } else { sb.append(node.text) @@ -202,6 +202,14 @@ object KDocRenderer { } MarkdownTokenTypes.GT -> sb.append(">") MarkdownTokenTypes.LT -> sb.append("<") + + MarkdownElementTypes.LINK_TEXT -> { + val childrenWithoutBrackets = node.children.drop(1).dropLast(1) + for (child in childrenWithoutBrackets) { + sb.append(child.toHtml()) + } + } + else -> { processChildren() } diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt index 6c1708fa14e..a151af0aea7 100644 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt +++ b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt @@ -2,10 +2,11 @@ * Some documentation. **Bold** *underline* `code` foo: bar (baz) [quux] 'apos' * * [Kotlin](http://www.kotlinlang.org) + * [a**b**__d__ kas ](http://www.ibm.com) * * [C] * - * [See this class][C] + * [See **this** class][C] */ fun testMethod() { @@ -19,6 +20,6 @@ fun test() { } //INFO: public fun testMethod(): Unit defined in root package

Some documentation. Bold underline code foo: bar (baz) quux 'apos'

-//INFO:

Kotlin

+//INFO:

Kotlin abdkas

//INFO:

C

-//INFO:

See this class

+//INFO:

Seethisclass