I'm writing doc comments to describe a method.
/**
* <p>necessary
* <p>setType is to set the PendingIntend's request code</p>
*/
But it won't show the paragraphs. If I don't use the <p>
, all the documentation is in a line without any break.
It works in Java class but when it comes to Kotlin, I don't know how to deal with it.
The language used to document Kotlin code (the equivalent of Java's Javadoc) is called KDoc. In its essence, KDoc combines Javadoc's syntax for block tags (extended to support Kotlin's specific constructs) and Markdown for inline markup.
Documenting Modules and Packages KDoc also supports documenting a package or a module using a custom markdown file. Open module.md in the app module. Replace the contents of the file (the TODO:4 line) with the following: # Module notktx-app ## Description This adds a custom module-level description for the app module.
Which of the following is NOT a way for creating a comment in Kotlin? Choose as many answers as you see fit. Add // at the beginning of or inside a line and anything after that // is considered a comment. Put /* or /** to start a block comment, and end it with */.
As said in documentation, KDoc (equivalent of Java’s JavaDoc in Kotlin) utilizes regular Markdown syntax for inline markup instead of HTML tags.
In Markdown, paragraphs are just split by an empty line, like this:
/**
* necessary
*
* setType is to set the PendingIntend's request code
*/
Also, please see this example in the Kotlin reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With