【发布时间】:2019-04-04 21:41:30
【问题描述】:
在我的 kDoc 中,我希望段落之间有一个空行。我该如何做到这一点? (还有什么地方有完整的指南吗?比如如何创建表格、项目符号等?)
【问题讨论】:
在我的 kDoc 中,我希望段落之间有一个空行。我该如何做到这一点? (还有什么地方有完整的指南吗?比如如何创建表格、项目符号等?)
【问题讨论】:
kdoc 使用降价,另见kdoc reference。该参考资料还指出,对于内联标记,他们使用以下markdown,但它看起来并不完全受支持。或者至少 Intellij IDEA(因此也可能是 Android Studio)不会像降价参考所描述的那样呈现它。当通过 Dokka 生成时,情况可能会更好。那个还没试过。
因此,如果您有标题 (#) 或使用空行,它将在行之间为您提供适当的空间,例如:
# Title (or ### title)
this line has some space before
或者只使用一个空行:
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...
如果您将<br /> 放在那里,它基本上应该添加一个新行,但至少它在 Intellij IDEA 中不起作用。但是,将其放在```-code-comment 中时它起作用了。也许是一个错误……也许是 Intellij IDEA 中的一个功能?如果有人可以玩 Dokka 并为此给出适当的答案,那就太好了,只是想分享我到目前为止所知道的。 (必须离开)
【讨论】:
Dokka 确实将空行视为段落分隔符,但忽略了<br> 和<br/>。考虑以下 KDoc 片段:
/**
* 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
这是它在 HTML 中的呈现方式:
【讨论】: