KDoc is the default documentation language for Kotlin, combining JavaDoc’s block tag syntax with Markdown for inline formatting. It is parsed by the Dokka engine to generate static API reference documentation. A KDoc comment is enclosed withinDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
/** and */. The parser strictly interprets the internal structure: the first paragraph serves as the summary of the element, subsequent paragraphs provide the detailed description, and the comment concludes with specific block tags.
Element Linking
Unlike JavaDoc, which relies on the{@link} syntax, KDoc uses standard Markdown link syntax with square brackets to reference other code elements. The compiler resolves these references based on the current scope.
Standard Block Tags
KDoc supports a specific set of block tags to document structural components of Kotlin code.@param <name>: Documents a value parameter of a function or a type parameter of a class/function.@return: Documents the return value of a function.@constructor: Documents the primary constructor of a class.@receiver: Documents the receiver type of an extension function or extension property.@property <name>: Documents a specific property of a class. This is often used to document properties declared directly in the primary constructor.@throws <class>/@exception <class>: Documents an exception that can be thrown by a method.@sample <identifier>: Embeds the body of the specified function into the generated documentation to demonstrate usage. The identifier must resolve to a valid Kotlin function.@see <identifier>: Adds a reference link to the “See Also” block of the generated documentation.@author: Specifies the author of the element.@since: Specifies the version in which the element was introduced.@suppress: Excludes the element from the generated documentation, even if the element is otherwise visible (e.g., public API).
Deprecation Handling
A critical structural difference between KDoc and JavaDoc is that KDoc does not support the@deprecated tag. To mark an element as deprecated and document the deprecation reason, developers must apply Kotlin’s built-in @Deprecated annotation directly to the code element. The documentation engine automatically extracts and formats the message provided in the annotation.
Syntax Specifics for Kotlin Constructs
Because Kotlin’s syntax differs from Java, KDoc provides specialized handling for Kotlin-specific features: Extension Functions: The@receiver tag is uniquely designed to document the instance an extension function operates on.
@property and @param.
Master Kotlin with Deep Grasping Methodology!Learn More





