> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin KDoc Comment

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 within `/**` 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.

```kotlin theme={"dark"}
/**
 * Calculates the cross product of two 3D vectors.
 *
 * This function utilizes standard matrix determinant expansion to compute
 * the orthogonal vector. It supports **Markdown** for formatting, such as
 * `inline code` or lists.
 *
 * @param v1 The first [Vector3D] operand.
 * @param v2 The second [Vector3D] operand.
 * @return A new [Vector3D] representing the cross product.
 * @throws IllegalArgumentException if either vector has a magnitude of zero.
 * @see Vector3D.dotProduct
 */
fun crossProduct(v1: Vector3D, v2: Vector3D): Vector3D {
    TODO("Implementation pending")
}
```

## 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.

```kotlin theme={"dark"}
/**
 * Dispatches the event to the [EventListener.onEvent] callback.
 * To use a custom dispatcher, see [com.example.core.Dispatcher].
 */
```

## 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.

```kotlin theme={"dark"}
/**
 * Processes the data payload.
 */
@Deprecated("Use processPayloadAsync() instead for non-blocking execution.")
fun processPayload(data: ByteArray) {
    // Implementation
}
```

## 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.

```kotlin theme={"dark"}
/**
 * Reverses the characters in the string while preserving case.
 *
 * @receiver The original string to be manipulated.
 * @return The reversed string.
 */
fun String.reversePreservingCase(): String {
    TODO("Implementation pending")
}
```

**Primary Constructors and Properties:**
Instead of writing separate KDoc blocks for the class, the primary constructor, and its properties, KDoc allows documenting them all within the class-level comment using `@property` and `@param`.

```kotlin theme={"dark"}
/**
 * Represents a network configuration.
 *
 * @property host The IP address or hostname of the server.
 * @property port The port number to bind to.
 * @constructor Creates a new configuration with the specified host and port.
 */
class NetworkConfig(val host: String, val port: Int)
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Kotlin Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
