As Kotlin continues to revolutionise the development landscape, effective documentation has become more crucial than ever.
That’s where KDoc comes in Kotlin’s powerful documentation tool. In this article, we will dive into the world of KDoc and will explore its basics, best practices and how the Dokka library can take documentation to the next level. 🚀
KDoc is Kotlin’s built-in documentation tool, similar to JavaDoc.
It allows you to document your code using comments, which are then processed to generate HTML documentation. Sounds simple? It is!
1. Block Tags
Block tags, denoted by the @ symbol, form the foundation of KDoc.
They furnish structured information about code elements, such as functions, classes, and properties.
Some commonly employed tags include:
- @param: Provides a description of a function’s parameter.
- @return: Describes the value returned by a function.
- @throws: Specifies the exceptions a function might throw.