missing_ code_ block_ language_ in_ doc_ comment
Learn about the missing_code_block_language_in_doc_comment linter rule.
A code block is missing a specified language.
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 {}
Enable
#
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
If you're instead using the YAML map syntax to configure
linter rules, add
missing_code_block_language_in_doc_comment: true
under linter > rules:
linter:
rules:
missing_code_block_language_in_doc_comment: true
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.