In my kDoc I want an empty line between paragraphs. How do I accomplish that? (Also is there a complete guide somewhere? Such as how to create tables, bullets, etc?)
3 Answers
kdoc uses markdown, see also kdoc reference. The reference also states that for inline markup they use the following markdown, but it doesn't look fully supported. Or at least Intellij IDEA (and therefore probably also Android Studio) doesn't render it as the markdown reference describes it. Maybe things are better, when generated via Dokka. Didn't try that one yet.
So if you have titles (#
) or use an empty line, it will give you an appropriate space between the lines, e.g.:
# Title (or ### title)
this line has some space before
or just using an empty line:
first line is the summary.
this line is now just written as the second line in your documentation. no space before... but maybe that suffices already...
If you place a <br />
in there it should basically add a new line, but at least it didn't work out in Intellij IDEA. However it worked when placing it in a ```
-code-comment. Maybe a bug... maybe a feature in Intellij IDEA? Would be good if anyone could play with Dokka and give an appropriate answer for this, just wanted to share what I know so far about it. (have to leave now)
Dokka indeed treats empty lines as paragraph separators, but ignores <br>
and <br/>
. Consider the following KDoc fragment:
/**
* This is the 1st paragraph.
*
* And this is the 2nd one. _IDEA_ indeed ignores any line breaks between
* paragraphs.
*
* # Heading 1
*
* This is the text after the heading.
*
* ### Heading 3
*
* This is the text after the heading.
* <br>
* This line is separated with `<br>`.
* <br/>
* And this one is separated with `<br/>`.
*/
class C
Here's how it is rendered in HTML:

- 4,977
- 2
- 36
- 82