Skip to content

Doc comment directives

Sam Rawlins edited this page Sep 6, 2020 · 5 revisions

Dartdoc supports several directives within Dart doc comments. Each directive is then processed during documentation generation, and new text is inserted in place of the directive. Not all directives are processed package documentation at https://pub.dev/.

Doc comment directives look something like {@DIRECTIVE ARG=VALUE ...}. Some require a closing directive, such as {@template} and {@endtemplate}.

Templates and macros

TODO(srawlins): Document

Examples

You can inline examples in the file system with the {@example} directive. You can specify the file path, the region, and the example language, with the following syntax:

{@example PATH [region=NAME] [lang=NAME]}

All example file names must have the extension, .md, and this extension must not be specified in the example PATH. PATH must be specified as a relative path from the root of the project root directory of the project for which docs are being generated. Given dir/file.dart as PATH, an example will be extracted from dir/file.dart.md, relative to the project root directory.

TODO(srawlins): Document region, lang, --example-path-prefix.

Injected HTML

TODO(srawlins): Document

Animations

TODO(srawlins): Document

YouTube videos

TODO(srawlins): Document

External tools

TODO(srawlins): Document

Interactivity

TODO(srawlins): Document

Clone this wiki locally