Search code examples
android-studiointellij-ideakotlinkdoc

Line break, new line in KDoc


Assuming we have such documented string

/** retrieve a state of the service
* <br/> HTTP code 200 - normal state
* <br/> HTTP code 403 - some recoverable state:
const val SERVICE_STATE = "servicestate" */

There are several <br/> here, which i used to break a line, like i do in java, but output of AndroidStudio (seems same in InteliJIdea) is enter image description here

with java it is parsed & displayed correctly:

/** retrieve a state of the service
 * <br/> HTTP code 200 - normal state
 * <br/> HTTP code 403 - some recoverable state */
public static final String SERVICE_STATE = "servicestate";

enter image description here

Can i somehow achieve the same with kotlin & IntelijIdea, maybe kotlin has another option to break the line in KDoc?


Solution

  • The KDoc format uses Markdown syntax instead of HTML, and basic Markdown does not provide a way to break the line without starting a new paragraph.

    I'm not sure why the Kotlin IntellIJ plugin does not support <br/> or the double space hack.

    If starting a new paragraph is OK, just skip an empty line:

    /** 
     * retrieve a state of the service
     *
     * HTTP code 200 - normal state
     *
     * HTTP code 403 - some recoverable state:
     */
    

    The result is:

    enter image description here