Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line break, new line in KDoc

Tags:

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?

like image 827
Beloo Avatar asked Mar 29 '18 14:03

Beloo


People also ask

What is a line break line?

noun. : the last line of a paragraph especially when not of full length when printed.

What is a line break in?

Updated: 07/31/2022 by Computer Hope. A line break is a command or sequence of control characters that returns the cursor to the next line and does not create a new paragraph. Essentially, line breaks denote the end of one line and the start of a new one.

What is KDoc in Kotlin?

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.

How do I add documents to Kotlin?

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.


1 Answers

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

like image 60
hotkey Avatar answered Oct 07 '22 03:10

hotkey