rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

`wrap_comments = true` breaks markdown tables

Open WaffleLapkin opened this issue 4 years ago • 2 comments

cargo fmt -- --config wrap_comments=true turns this:

/// doc
///
/// Table that is > 80 symbols:
///
/// | table | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
/// |-------|--------------------------------------------------------------------|
/// | val   | x                                                                  |
struct Item;

image

Into this:

/// doc
///
/// Table that is > 80 symbols:
///
/// | table | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/// |
/// |-------|--------------------------------------------------------------------|
/// | val   | x
/// |
struct Item;

image

It's possible to work around this issue by adding #[rustfmt::skip] to the struct (or other documented item), but I think it's a bug anyway.

WaffleLapkin avatar May 27 '20 08:05 WaffleLapkin

What is necessary to perform the backport here? If it's just cherry-picking the commits onto another branch I'm willing to do that if you let me know which branch.

Nemo157 avatar Jul 28 '22 17:07 Nemo157

@Nemo157, thanks for your interest. It might be as simple as a cherry-pick, but I don't know. I believe this is the PR #4214

ytmimi avatar Jul 28 '22 18:07 ytmimi