6

I have a object like the following in my project

object UrlUtils {

    private const val PARAM = "whatever"

    /**
     * Method that appends the [PARAM] parameter to the url
     */
    fun appendParameter(url: String) {
        // ...
    }

}

As you can see a I wanna reference the value of the PARAM field in the KDoc comment of the appendParameter method however when looking at the comment I don't see the actual value but only the name of the field.

Method that appends the PARAM parameter to the url

What I want:

Method that appends the whatever parameter to the url

In Javadoc this works by using {@value PARAM} but there seems to be nothing similar in KDoc. Even the automatic code-converter keeps the old Javadoc.

So my question: Am I missing something or is KDoc/Dokka missing this feature?

user3420815
  • 775
  • 9
  • 20

1 Answers1

5

Currently, {@value} tags are not supported by KDoc.

The closest issue requesting this is #488, so you can up-vote and/or comment on it.

Bass
  • 4,977
  • 2
  • 36
  • 82
  • 1
    Looks like that was implemented in 1.4.x but to me it is not the thing that I would like to see and also not the thing that original question asked for. Dokka can now render default value of `fun` parameter if it was assigned a primitive constant. But "unwrapping" it's value in rendered kdoc (`/** MY DOCUMENTATION */`) is sadly not there, as I understood. – Den Drobiazko Jul 07 '23 at 12:34
  • 1
    Exactly. The values of constants are documented by default, but you can't reference any such value from an arbitrary KDoc fragment the way you could do in JavaDoc. – Bass Jul 07 '23 at 23:18