gpt4 book ai didi

kotlin - KDoc 中的表?

转载 作者:行者123 更新时间:2023-12-04 08:45:19 25 4
gpt4 key购买 nike

我们通常在 Java DTO 中有更改日志,其中包含在 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 {
...
}

这很好地呈现(在 Intellij 中使用 Javadoc 预览)如下所示:

enter image description here

现在我们想为 Kotlin 数据类做同样的事情。阅读 KDoc 的文档它说:

For inline markup, KDoc uses the regular Markdown syntax, extended to support a shorthand syntax for linking to other elements in the code.



所以我尝试使用 Markdown 语法创建一个表:
/**
* Changelog:
*
*| Version | Description |
*| ------------- | -------------------------- |
*| 2 | Added field 'something' |
*| 3 | Added field 'somethingElse' |
*
*/
data class MyKotlinDTO(..) {
...
}

但这呈现(再次使用 Intellij 预览):

enter image description here

这看起来不像一张 table 。

我也试过只使用 HTML 表格,但这也不起作用。

问题

KDoc 是否支持表格,如果支持,您如何创建表格?

最佳答案

目前 KDoc 不支持表格 - 在 Github 上存在问题。和 Youtrack

有一些解决方法 - 您可以用 包围文本``` (三重反引号)保持缩进和格式

关于kotlin - KDoc 中的表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50074296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com