-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leverage itemized blocks to support formatting markdown block quotes
Fixes 5157 Doc comments support markdown, but rustfmt didn't previously assign any semantic value to leading '> ' in comments. This lead to poor formatting when using ``wrap_comments=true``. Now, rustfmt treats block quotes as itemized blocks, which greatly improves how block quotes are formatted when ``wrap_comments=true``.
- Loading branch information
1 parent
b05b313
commit 1e78a2b
Showing
7 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests/source/issue-5157/indented_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
fn block_quote() {} |
10 changes: 10 additions & 0 deletions
10
tests/source/issue-5157/nested_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
/// | ||
/// > > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
/// | ||
/// > > > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
/// | ||
/// > > > > > > > > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
fn block_quote() {} |
4 changes: 4 additions & 0 deletions
4
tests/source/issue-5157/support_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a sample_state relative to each DataReader. The sample_state can either be READ or NOT_READ. | ||
fn block_quote() {} |
6 changes: 6 additions & 0 deletions
6
tests/target/issue-5157/indented_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a | ||
/// > sample_state relative to each DataReader. The sample_state can | ||
/// > either be READ or NOT_READ. | ||
fn block_quote() {} |
18 changes: 18 additions & 0 deletions
18
tests/target/issue-5157/nested_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a | ||
/// > sample_state relative to each DataReader. The sample_state can either be | ||
/// > READ or NOT_READ. | ||
/// | ||
/// > > For each sample received, the middleware internally maintains a | ||
/// > > sample_state relative to each DataReader. The sample_state can either be | ||
/// > > READ or NOT_READ. | ||
/// | ||
/// > > > For each sample received, the middleware internally maintains a | ||
/// > > > sample_state relative to each DataReader. The sample_state can either | ||
/// > > > be READ or NOT_READ. | ||
/// | ||
/// > > > > > > > > For each sample received, the middleware internally | ||
/// > > > > > > > > maintains a sample_state relative to each DataReader. The | ||
/// > > > > > > > > sample_state can either be READ or NOT_READ. | ||
fn block_quote() {} |
6 changes: 6 additions & 0 deletions
6
tests/target/issue-5157/support_itemized_markdown_blockquote.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// rustfmt-wrap_comments: true | ||
|
||
/// > For each sample received, the middleware internally maintains a | ||
/// > sample_state relative to each DataReader. The sample_state can either be | ||
/// > READ or NOT_READ. | ||
fn block_quote() {} |