Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
atyrin opened this issue Nov 29, 2023 · 5 comments
Open

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

atyrin opened this issue Nov 29, 2023 · 5 comments
Labels
bug kdoc-spec An issue that requires clarification from the KDoc spec's perspective topic: K2 Issues / PRs that are related to the K2 migration. See #2888

Comments

@atyrin
Copy link
Contributor

atyrin commented Nov 29, 2023

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: #3328

@atyrin atyrin added bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888 labels Nov 29, 2023
@atyrin
Copy link
Contributor Author

atyrin commented Nov 30, 2023

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) {}

@vmishenev
Copy link
Contributor

Note
Both cases do not work in IDE K1:

image
image

They lead to an internal error in IDE:
image

@vmishenev
Copy link
Contributor

vmishenev commented Dec 13, 2023

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.

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Dec 15, 2023

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 IgnatBeresnev added the kdoc-spec An issue that requires clarification from the KDoc spec's perspective label Dec 15, 2023
@vmishenev
Copy link
Contributor

vmishenev commented Feb 26, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug kdoc-spec An issue that requires clarification from the KDoc spec's perspective topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Projects
None yet
Development

No branches or pull requests

3 participants