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

Markdown formatting is adding line breaks around 80 characters, Prettier does not add any by default. #9191

Closed
David-Else opened this issue Jan 20, 2021 · 6 comments
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)

Comments

@David-Else
Copy link

@dsherret In the following example.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

prettier --write filename.md does not change the formatting. deno fmt filename.md creates:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.

An unwanted linebreak has been inserted, this makes it impossible to work with any text that needs to reflow... like 99% of text on the web. Thanks :)

@kitsonk
Copy link
Contributor

kitsonk commented Jan 20, 2021

Markdown is supposed to reflow itself. If you take a look at our documentation, it is all formatted with dprint at 80 cols and reflows perfectly fine when rendered as HTML. Markdown requires two line breaks to actually break a line.

@kitsonk kitsonk added deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed) labels Jan 20, 2021
@David-Else
Copy link
Author

David-Else commented Jan 20, 2021

@kitsonk OK, that is interesting. I had not actually tested it with HTML, it was just a shock to see the non-standard formatting. I think it would be much better to leave it at the Prettier default as the editor can take care of the word wrapping.

VSCode soft wraps with:

  "[markdown]": {
    "editor.wordWrap": "wordWrapColumn"
  },

and Vim/Neovim soft wraps to Window size with:

  " wrap at word boundaries rather than right at the terminal edge
  set linebreak

Having it hard wrapped at 80 cols can be super annoying, and differs from the expected Prettier default compatability.

It would be interseting to hear what other people think.

@dsherret
Copy link
Member

dsherret commented Jan 20, 2021

Just a note that it's configured to do this here, which is similar to prettier's pros-wrap: always config:

.text_wrap(dprint_plugin_markdown::configuration::TextWrap::Always)

@kitsonk
Copy link
Contributor

kitsonk commented Jan 21, 2021

it was just a shock to see the non-standard formatting

I disagree that it is non-standard... It just doesn't meet your expectations.

Having it hard wrapped at 80 cols can be super annoying.

Deno has been consistent in hard wrapping at 80 cols, be it code, or be it now markdown.

@dsherret thanks for the heads up on the config.

@wojpawlik
Copy link

While I don't mind hard-wrapping long lines, joining shorter lines causes noisy diffs:

obraz

Left: each part of the sentence is a separate line, so rewriting it doesn't affect the rest of the paragraph.
Right: rewriting the beginning of the sentence might reflow the entire paragraph.

https://rhodesmill.org/brandon/2012/one-sentence-per-line/

@bartlomieju
Copy link
Member

This was addressed in #11857 and can be configured using --options-text-wrap or fmt::textWrap options in config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

5 participants