Search code examples
androidjavadockotlinkdoc

Kotlin documentation doesn't support tags like '<p>' well


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.


Solution

  • 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.