Skip to content

Leading whitespaces are preserved in a code span #4138

@sgrekhov

Description

@sgrekhov

According to the Dart doc comment specification:

For each line that begins with ///, the parser removes the three slashes and all leading whitespace to produce the documentation text. Exception: inside fenced code blocks (```), whitespace after the leading /// is preserved to maintain code formatting.

The only exception is a fenced code blocks. But in case of code span (`) leading whitespaces are also preserved.
Example.

/// `
/// main() {
///   print('No leading whitespaces expected');
/// }
/// `

dart doc output is:

`
main() {
  print('No leading whitespaces expected');
}
`

Link to the appropriate failing test will be added later after landing of the pull request containing the test.

Metadata

Metadata

Assignees

No one assigned

    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