Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap_comments overflows into codeblock fence #6416

Closed
grant0417 opened this issue Dec 12, 2024 · 1 comment
Closed

wrap_comments overflows into codeblock fence #6416

grant0417 opened this issue Dec 12, 2024 · 1 comment
Labels
a-comments a-markdown markdown formatting in doc comments duplicate

Comments

@grant0417
Copy link
Contributor

grant0417 commented Dec 12, 2024

When using a code block in a doc comment and wrap_comments is enabled, the comment will wrap into the next line making the following code block no longer valid a valid code block.

The syntax reference for rustdoc says that exact syntax is the Fenced Code Blocks section of the CommonMark specification. The CommonMark spec states: "A fenced code block may interrupt a paragraph, and does not require a blank line either before or after."

Example

Initial code:

/// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
/// ```
/// let foo = 0;
/// ```
fn bar() {}

Result:

/// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam
/// lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam ```
/// let foo = 0;
/// ```

Expected:

/// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam
/// lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam 
/// ```
/// let foo = 0;
/// ```
@grant0417 grant0417 changed the title wrap_line overflows into codeblock fence wrap_comments overflows into codeblock fence Dec 12, 2024
@ytmimi
Copy link
Contributor

ytmimi commented Dec 12, 2024

Duplicate of #5244

@ytmimi ytmimi marked this as a duplicate of #5244 Dec 12, 2024
@ytmimi ytmimi closed this as completed Dec 12, 2024
@ytmimi ytmimi added duplicate a-comments a-markdown markdown formatting in doc comments labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-comments a-markdown markdown formatting in doc comments duplicate
Projects
None yet
Development

No branches or pull requests

2 participants