Fix for KT-13038 Quick doc should escape HTML entities in code blocks
This commit is contained in:
@@ -203,10 +203,12 @@ object KDocRenderer {
|
||||
MarkdownTokenTypes.RPAREN,
|
||||
MarkdownTokenTypes.LBRACKET,
|
||||
MarkdownTokenTypes.RBRACKET,
|
||||
MarkdownTokenTypes.EXCLAMATION_MARK,
|
||||
MarkdownTokenTypes.CODE_FENCE_CONTENT-> {
|
||||
MarkdownTokenTypes.EXCLAMATION_MARK -> {
|
||||
sb.append(nodeText)
|
||||
}
|
||||
MarkdownTokenTypes.CODE_FENCE_CONTENT -> {
|
||||
sb.append(nodeText.htmlEscape())
|
||||
}
|
||||
MarkdownTokenTypes.EOL -> {
|
||||
val parentType = node.parent?.type
|
||||
if (parentType == MarkdownElementTypes.CODE_BLOCK || parentType == MarkdownElementTypes.CODE_FENCE) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Code block:
|
||||
* ``` kotlin
|
||||
* A<T>
|
||||
* ```
|
||||
* Code span:
|
||||
* `<T>` is type parameter
|
||||
*/
|
||||
class <caret>A<T>
|
||||
|
||||
//INFO: <b>public</b> <b>final</b> <b>class</b> A<T> <i>defined in</i> root package<p>Code block:</p>
|
||||
//INFO: <pre><code>
|
||||
//INFO: A<T>
|
||||
//INFO: </code></pre><p>Code span: <code><T></code> is type parameter</p>
|
||||
+6
@@ -72,6 +72,12 @@ public class QuickDocProviderTestGenerated extends AbstractQuickDocProviderTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EscapeHtmlInsideCodeBlocks.kt")
|
||||
public void testEscapeHtmlInsideCodeBlocks() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/EscapeHtmlInsideCodeBlocks.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaClassUsedInKotlin.kt")
|
||||
public void testJavaClassUsedInKotlin() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/quickDoc/JavaClassUsedInKotlin.kt");
|
||||
|
||||
Reference in New Issue
Block a user