don't trim whitespace when converting whitespace to HTML
#KT-10998 Fixed
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -23,7 +23,7 @@ fun test() {
|
||||
}
|
||||
|
||||
//INFO: <b>public</b> <b>fun</b> testMethod(): Unit <i>defined in</i> root package<p>Some documentation. <strong>Bold</strong> <em>underline</em> <code>code</code> foo: bar (baz) <a href="psi_element://quux">quux</a> 'apos'</p>
|
||||
//INFO: <p><a href="http://www.kotlinlang.org">Kotlin</a> <a href="http://www.ibm.com">a<strong>b</strong><strong>d</strong>kas</a></p>
|
||||
//INFO: <p><a href="http://www.kotlinlang.org">Kotlin</a> <a href="http://www.ibm.com">a<strong>b</strong><strong>d</strong> kas</a></p>
|
||||
//INFO: <p><a href="psi_element://C">C</a></p>
|
||||
//INFO: <p><a href="psi_element://C">See<strong>this</strong>class</a></p>
|
||||
//INFO: <p><a href="psi_element://C">See <strong>this</strong> class</a></p>
|
||||
//INFO: <p>This is <em>emphasized text</em> but text_with_underscores has to preserve the underscores. Single stars embedded in a word like Embedded*Star have to be preserved as well.</p>
|
||||
|
||||
@@ -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() {
|
||||
<caret>testMethod(1, "value")
|
||||
}
|
||||
|
||||
//INFO: <b>public</b> <b>fun</b> testMethod(a: Int, b: String): Unit <i>defined in</i> root package<p>Some documentation</p>
|
||||
//INFO: <dl><dt><b>Parameters:</b></dt><dd><code>a</code> - Some int</dd><dd><code>b</code> - String</dd></dl>
|
||||
//INFO: <dl><dt><b>Returns:</b></dt><dd>Return <a href="psi_element://a">a</a> and nothing else</dd></dl>
|
||||
+6
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user