missing_code_block_language_in_doc_comment
A code block is missing a specified language.
This rule is available as of Dart 3.4.
Details
#DO specify the language used in the code block of a doc comment.
To enable proper syntax highlighting of Markdown code blocks, dart doc
strongly recommends code blocks to specify the language used after the initial code fence.
See highlight.js for the list of languages supported by dart doc
. To disable syntax highlighting or if no language is suitable, you can specify none
as the language.
BAD:
/// ```
/// void main() {}
/// ```
class A {}
GOOD:
/// ```dart
/// void main() {}
/// ```
class A {}
Usage
#To enable the missing_code_block_language_in_doc_comment
rule, add missing_code_block_language_in_doc_comment
under linter > rules in your analysis_options.yaml
file:
linter:
rules:
- missing_code_block_language_in_doc_comment
Unless stated otherwise, the documentation on this site reflects Dart 3.5.4. Page last updated on 2024-07-03. View source or report an issue.