diff --git a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt index 71a89944799..3a8fdc0b372 100644 --- a/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/kdoc/KDocRenderer.kt @@ -121,6 +121,10 @@ object KDocRenderer { } fun MarkdownNode.toHtml(): String { + if (node.type == MarkdownTokenTypes.WHITE_SPACE) { + return text // do not trim trailing whitespace + } + val sb = StringBuilder() visit { node, processChildren -> fun wrapChildren(tag: String, newline: Boolean = false) { diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt index d2e802e953a..501528184df 100644 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt +++ b/idea/testData/editor/quickDoc/OnMethodUsageWithMarkdown.kt @@ -23,7 +23,7 @@ fun test() { } //INFO: public fun testMethod(): Unit defined in root package

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

-//INFO:

Kotlin abdkas

+//INFO:

Kotlin abd kas

//INFO:

C

-//INFO:

Seethisclass

+//INFO:

See this class

//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.

diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt b/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt new file mode 100644 index 00000000000..79f856c02a5 --- /dev/null +++ b/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt @@ -0,0 +1,18 @@ +/** +Some documentation + + * @param a Some int + * @param b String + * @return Return [a] and nothing else + */ +fun testMethod(a: Int, b: String) { + +} + +fun test() { + testMethod(1, "value") +} + +//INFO: public fun testMethod(a: Int, b: String): Unit defined in root package

Some documentation

+//INFO:
Parameters:
a - Some int
b - String
+//INFO:
Returns:
Return a and nothing else
diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocProviderTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocProviderTestGenerated.java index 29f800b0557..139e5581d3d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocProviderTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocProviderTestGenerated.java @@ -143,6 +143,12 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest doTest(fileName); } + @TestMetadata("OnMethodUsageWithReturnAndLink.kt") + public void testOnMethodUsageWithReturnAndLink() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt"); + doTest(fileName); + } + @TestMetadata("OnMethodUsageWithReturnAndThrows.kt") public void testOnMethodUsageWithReturnAndThrows() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndThrows.kt");