Skip to content

Line with no leading * in block comment is truncated #4157

@sgrekhov

Description

@sgrekhov

Consider the block comment like:

/** Line 1
 * Line 2
   Line 3
 * Line 4
 
 * Line 5
 */

According to the specification

The content within the delimiters is treated as the documentation. On each line after the opening /**, any leading whitespace followed by a single asterisk (*) is considered stylistic and is stripped by doc generators. Any whitespace immediately following the asterisk is also stripped, if present.

Only lines starting with * (probably with a leading/trailing whitespace) should be truncated. Therefore any line between delimiters should be unchanged. I fact we have:

Expected: 'Line 1\n'
            'Line 2\n'
            '   Line 3\n'
            'Line 4\n'
            '\n'
            'Line 5'
  Actual: 'Line 1\n'
            'Line 2\n'
            '  Line 3\n'
            'Line 4\n'
            '\n'
            'Line 5'

Actual Line 3 has one space character less than expected.

See https://github.com/dart-lang/dartdoc/blob/main/test/co19/block_based_doc_comments_test.dart the test test_noAsteriskLinePreserved().

Dart SDK version: 3.11.0-260.0.dev (dev) (Thu Dec 18 12:03:14 2025 -0800) on "windows_x64"

Metadata

Metadata

Assignees

Labels

type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions