0

dokka kotlin 类似于 javadoc 的文档生成工具

borgel created at6 years ago view count: 2867

项目地址: https://github.com/Kotlin/dokka

类似于 javadoc 通过注释生成文档, 稍微规范点的项目都应该用上这个。

下面是一个例子:

/**
 * A group of *members*.
 *
 * This class has no useful logic; it's just a documentation example.
 *
 * @param T the type of a member in this group.
 * @property name the name of this group.
 * @constructor Creates an empty group.
 */
class Group<T>(val name: String) {
    /**
     * Adds a [member] to this group.
     * @return the new size of the group.
     */
    fun add(member: T): Int { ... }
}

KDoc 的语法和使用细节可以查看官方的文档。

https://kotlinlang.org/docs/reference/kotlin-doc.html

report
回复
0
neo #
when in doubt, use brute force

现在这些通过代码注释生成文档的工具都可以用 Markdown 语法, 所以写出来的文档看起来很美观。 最近都用 swagger 管理 server 端的 API 文档。 同时方便调试。 唯一的缺点就是代码看起来会很长,提交历史里面会比较杂。不过总的来说利大于弊。

6 years ago 回复