Skip to main content

unintended_html_in_doc_comment

Angle brackets will be interpreted as HTML.

Description

#

The analyzer produces this diagnostic when a documentation comment contains angle bracketed text (<...>) that isn't one of the allowed exceptions.

Such text is interpreted by markdown to be an HTML tag, which is rarely what was intended.

See the lint rule description for the list of allowed exceptions.

Example

#

The following code produces this diagnostic because the documentation comment contains the text <int>, which isn't one of the allowed exceptions:

dart
/// Converts a List<int> to a comma-separated String.
String f(List<int> l) => '';

Common fixes

#

If the text was intended to be part of a code span, then add backticks around the code:

dart
/// Converts a `List<int>` to a comma-separated String.
String f(List<int> l) => '';

If the text was intended to be part of a link, then add square brackets around the code:

dart
/// Converts a [List<int>] to a comma-separated String.
String f(List<int> l) => '';

If the text was intended to be printed as-is, including the angle brackets, then add backslash escapes before the angle brackets:

dart
/// Converts a List\<int\> to a comma-separated String.
String f(List<int> l) => '';