Skip to content

Handling of newline in RustDoc #120

@ralpha

Description

@ralpha

Should or should we not change the default parsing behavior from the current (removing single \n in RustDoc)
to just leaving the newline in.

To clarify for everyone we are talking about:

/// Some documentation
/// on multiple lines
/// right here.
/// 
/// This is a new paragraph.
struct Test{
   // ...
}

Should this result in:

"Some documentation on multiple lines right here.\n\nThis is a new paragraph." // Current (2021/11/25)
// or
"Some documentation\non multiple lines\nright here.\n\nThis is a new paragraph." // If we change is back

This question came up in: #38

The intention is that it removes extraneous newlines from simple text doc comments, since they may be spread across multiple lines just to keep the line length of the original Rust source reasonable, which ideally wouldn't affect any generated schema. However, this does indeed mangle more complex markdown e.g. code blocks and lists, so it might be doing more harm than good... I'm definitely considering removing this behaviour, and passing down the docstring unaltered as you suggest

#38 (comment)

A Visitor can be created to do this behavior and users can enable or disable it as they want.
But the default has to be one way or the other. (to be decided in this issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions