目录

unintended_html_in_doc_comment

目录

Use of angle brackets in a doc comment is treated as HTML by Markdown.

This rule is available as of Dart 3.5.0.

Details

#

DO reference only in-scope identifiers in doc comments.

When a developer writes a reference with angle brackets within a doc comment, the angle brackets are interpreted as HTML. The text within pairs of opening and closing angle brackets generally get swallowed by the browser, and will not be displayed.

You can use a code block or code span to wrap the text containing angle brackets. You can also replace < with &lt; and > with &gt;.

BAD:

dart
/// Text List<int>.
/// Text [List<int>].
/// <assignment> -> <variable> = <expression>

GOOD:

dart
/// Text `List<int>`.
/// `<assignment> -> <variable> = <expression>`
/// <http://foo.bar.baz>

Usage

#

To enable the unintended_html_in_doc_comment rule, add unintended_html_in_doc_comment under linter > rules in your analysis_options.yaml file:

analysis_options.yaml
yaml
linter:
  rules:
    - unintended_html_in_doc_comment