dokka icon indicating copy to clipboard operation
dokka copied to clipboard

[K2] KDoc references that goes after markdown blocks don't have links

Open atyrin opened this issue 1 year ago • 4 comments

class JavaNetCookieJar

interface CookieJar {
    /**
     * Markdown syntax ```code```
     * This references doesn't work: [System.currentTimeMillis] and [JavaNetCookieJar].
     */
    fun saveFromResponse(url: String)
}

In K1, references are resolved: image


In K2 are not:

image

If I put a reference before the code block in the samples, it will be resolved. Also, if it the same as reference after, like:

/**
     * This references works: [System.currentTimeMillis] and [JavaNetCookieJar]  
     * Markdown syntax ```code```
     * This references doesn't work: [System.currentTimeMillis] and [JavaNetCookieJar].
     */

The both will be resolved.

Installation

  • Dokka version: 1.9.20

Parent: https://github.com/Kotlin/dokka/issues/3328

atyrin avatar Nov 29 '23 15:11 atyrin

One more case. Reference works in K1 and doesn't in K2

interface Call

/**
 * @param text some description with reference.
 *     But with a few lines and indent [Call]
 */
fun protocol(text: String) {}

atyrin avatar Nov 30 '23 11:11 atyrin

Note Both cases do not work in IDE K1:

image image

They lead to an internal error in IDE: image

vmishenev avatar Dec 04 '23 13:12 vmishenev

There is a problem in a parser of compiler (PSI). see https://github.com/JetBrains/kotlin/blob/master/compiler/psi/src/org/jetbrains/kotlin/kdoc/lexer/KDoc.flex image

There is a workaround on Dokka's side: to resolve KDoc links like in K1.

vmishenev avatar Dec 13 '23 21:12 vmishenev

The second case with @param I would expect to work, but line breaks in KDoc tags are not specified by the KDoc spec, so it might require additional work from the compiler / analysis API.

The first case with code blocks might be invalid markdown, we need to check the spec.


Markdown file parsing should be fixed (module/package descriptions)

IgnatBeresnev avatar Dec 15 '23 13:12 IgnatBeresnev