KDoc中的表? [英] Tables in KDoc?
问题描述
我们通常在Java DTO中有一个changelog,它包含用Javadoc定义的表:
We usually have changelog in our Java DTO's that consists of a table defined in Javadoc:
/**
* Changelog:
*
* <table>
* <tr><th>Version</th><th>Description</th></tr>
* <tr>
* <td>2</td>
* <td>Added field 'something'</td>
* </tr>
* <tr>
* <td>3</td>
* <td>Added field 'somethingElse'</td>
* </tr>
* </table>
*/
public class MyDTO {
...
}
这很好地呈现(在使用Javadoc预览的Intellij中)这样的东西:
This renders (in Intellij using Javadoc preview) nicely into something like this:
现在,我们希望对Kotlin数据类执行相同的操作.阅读 KDoc 的文档,其中写着:>
Now we want to do the same thing for our Kotlin data classes. Reading up on the docs of KDoc where it says:
对于内联标记,KDoc使用常规的Markdown语法,已扩展为支持链接到代码中其他元素的简写语法.
For inline markup, KDoc uses the regular Markdown syntax, extended to support a shorthand syntax for linking to other elements in the code.
因此,我尝试使用Markdown语法创建表:
So I've tried to create a table using Markdown syntax:
/**
* Changelog:
*
*| Version | Description |
*| ------------- | -------------------------- |
*| 2 | Added field 'something' |
*| 3 | Added field 'somethingElse' |
*
*/
data class MyKotlinDTO(..) {
...
}
但这会渲染(再次使用Intellij预览):
But this renders (again using Intellij preview):
哪个看起来不像桌子.
我也尝试过仅使用HTML表,但这也不起作用.
I've also tried just using an HTML table but that doesn't work either.
问题
KDoc是否支持表?如果是,如何创建表?
Does KDoc support tables and if so how do you create one?
推荐答案
当前KDoc不支持表-在 Github 和 Youtrack
Currently KDoc does not support tables - there are issues opened on Github and Youtrack
有一种解决方法-您可以使用`(三行反引号)将文本括起来,以保持缩进和格式
There is some kind of workaround - you can surround text with ``` (triple backticks) to keep indentations and formatting
这篇关于KDoc中的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!