kdoc

Tables in KDoc?

*爱你&永不变心* 提交于 2019-12-30 09:49:07
问题 We usually have changelog in our Java DTO's that consists of a table defined in Javadoc: /** * Changelog: * * <table> * <tr><th>Version</th><th>Description</th></tr> * <tr> * <td>2</td> * <td>Added field 'something'</td> * </tr> * <tr> * <td>3</td> * <td>Added field 'somethingElse'</td> * </tr> * </table> */ public class MyDTO { ... } This renders (in Intellij using Javadoc preview) nicely into something like this: Now we want to do the same thing for our Kotlin data classes. Reading up on

How do I inherit KDoc documentation?

微笑、不失礼 提交于 2019-12-19 05:13:02
问题 In Java's Javadoc, there is a way to inherit a method's documentation in a subclass using {@inheritDoc} tag. Is there a way to do the same in Kotlin's KDoc? Basically, what I'd like to do is the following: abstract class Base { /** * Some KDoc documentation here. */ abstract fun foo() } class Derived: Base() { /** * Here is all the documentation from Base#foo's KDoc inherited. * * And here goes something more in addition. */ override fun foo() { /* ... */ } } 回答1: Dokka always copies the

KDoc: Insert code snippet

孤人 提交于 2019-12-08 14:34:00
问题 How do I insert a code snippet in KDoc, Kotlin's default documentation tool? In Java, I can use the following: /** * Example usage: * * <pre> * <code>@JavaAnnotation * public void foo() { * // Code * } * </code> * </pre> */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface JavaAnnotation {} There seems to be no equivalent in Kotlin. I tried using Markdown, but inserting 2 spaces after line end does not line-break. 回答1: You can use triple backticks: /** *

Reference value of constant with KDoc

折月煮酒 提交于 2019-12-01 11:25:55
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

Reference value of constant with KDoc

偶尔善良 提交于 2019-12-01 07:32:36
问题 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

Tables in KDoc?

扶醉桌前 提交于 2019-12-01 06:05:40
We usually have changelog in our Java DTO's that consists of a table defined in Javadoc: /** * Changelog: * * <table> * <tr><th>Version</th><th>Description</th></tr> * <tr> * <td>2</td> * <td>Added field 'something'</td> * </tr> * <tr> * <td>3</td> * <td>Added field 'somethingElse'</td> * </tr> * </table> */ public class MyDTO { ... } This renders (in Intellij using Javadoc preview) nicely into something like this: Now we want to do the same thing for our Kotlin data classes. Reading up on the docs of KDoc where it says: For inline markup, KDoc uses the regular Markdown syntax, extended to

Kotlin KDoc: Documentation?

若如初见. 提交于 2019-12-01 04:21:11
I have seen here , here and there references to KDoc, the JavaDoc utility equivalent for Kotlin. However, I cannot find any documentation on how to use it, let alone how to customize it or integrate it in Maven or Gradle. I know the Kotlin API doc is generated using KDoc since the page source has the following HTML comment: <!-- Generated by kdoc on Sun Jul 06 20:27:33 UTC 2014 --> So, is there any documentation I can refer to as to how to use KDoc ? monkjack It looks like Kdoc was put on the back burner in favour of Dokka. https://github.com/Kotlin/dokka Source: https://devnet.jetbrains.com

How do I inherit KDoc documentation?

只谈情不闲聊 提交于 2019-12-01 02:51:24
In Java's Javadoc, there is a way to inherit a method's documentation in a subclass using {@inheritDoc} tag . Is there a way to do the same in Kotlin's KDoc? Basically, what I'd like to do is the following: abstract class Base { /** * Some KDoc documentation here. */ abstract fun foo() } class Derived: Base() { /** * Here is all the documentation from Base#foo's KDoc inherited. * * And here goes something more in addition. */ override fun foo() { /* ... */ } } Dokka always copies the documentation from a base member to an inherited one if the inherited member does not have its own

Kotlin KDoc: Documentation?

半城伤御伤魂 提交于 2019-12-01 01:35:30
问题 I have seen here, here and there references to KDoc, the JavaDoc utility equivalent for Kotlin. However, I cannot find any documentation on how to use it, let alone how to customize it or integrate it in Maven or Gradle. I know the Kotlin API doc is generated using KDoc since the page source has the following HTML comment: <!-- Generated by kdoc on Sun Jul 06 20:27:33 UTC 2014 --> So, is there any documentation I can refer to as to how to use KDoc ? 回答1: It looks like Kdoc was put on the back