documentation - 如何在 kotlin kDoc 中使用 @link 和 @code

标签 documentation kotlin kdoc

我正在尝试记录一个方法并尝试使用 @link@code,如 JavaDoc .

我知道在 kotlin 中有一个 kDoc但我找不到它们,或者至少找不到类似的东西。

最佳答案

@link@code 在 kDoc 中不存在,但可以轻松替换为 Inline Markup .

来自 KotlinDoc Linking to Elements

Inline Markup

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

Linking to Elements

To link to another element (class, method, property or parameter), simply put its name in square brackets:

Use the method [foo] for this purpose.

If you want to specify a custom label for the link, use the Markdown reference-style syntax:

Use [this method][foo] for this purpose. You can also use qualified names in the links. Note that, unlike JavaDoc, qualified names always use the dot character to separate the components, even before a method name:

Use [kotlin.reflect.KClass.properties] to enumerate the properties of the class. Names in links are resolved using the same rules as if the name was used inside the element being documented. In particular, this means that if you have imported a name into the current file, you don't need to fully qualify it when you use it in a KDoc comment.

Note that KDoc does not have any syntax for resolving overloaded members in links. Since the Kotlin documentation generation tool puts the documentation for all overloads of a function on the same page, identifying a specific overloaded function is not required for the link to work.

关于documentation - 如何在 kotlin kDoc 中使用 @link 和 @code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45195370/

相关文章:

java - Android Studio模拟器:流程结束,退出代码为-1073741515(0xC0000135)

android - 文档模板生成 kotlin

c# - 在 C# 中继承文档?

perl - 如何在 Pod 和 perldoc 中使用 Unicode 字符?

git - 如何将文档历史记录与源历史记录分开?

gradle - 将多个源语言文档合并到一个 Javadoc JAR 中

Kotlin KDoc : Documentation?

scala - 如何在 IntelliJ 中查看 Scala 文档

Kotlin 中的 JUnit 测试

android - 实时模板在 Kotlin 中不起作用