20.1 Doc comment syntax
/// runs, Markdown bodies, and structured @ directives.
Doc comment syntax
A documentation run is consecutive lines starting with /// where the third / is not followed by another /. Block comments and // lines are not API documentation—do not @inheritdoc your way around that.
Documentation attaches to top-level declarations and nested members (fields, variants, contract members, methods, parameters, and test-body statements where supported). Write Markdown in the body; use structured tags for machine-readable sections.
A small authoring routine
Section titled “A small authoring routine”- State the declaration’s purpose and any non-obvious precondition or consequence.
- Add structured tags only where they clarify the callable API or link a reader onward.
- Review the rendered or generated documentation with the declaration, not as a separate prose artifact.
This page is a guide to the workflow. The documentation-comments feature owns the exact syntax and attachment rules.