hukkin / mdformat-gfm

Mdformat plugin for GitHub Flavored Markdown compatibility
MIT License
13 stars 2 forks source link

Do not replace trailing double space with backslash #24

Closed drts01 closed 2 years ago

drts01 commented 2 years ago

The GitHub Flavored Markdown Spec states two trailing spaces for a hard-line break as valid.

Basic writing and formatting syntax

Every new line should be prefixed with 2 spaces.

hukkin commented 2 years ago

Thanks for the issue!

mdformat is an opinionated formatter that prefers a trailing backslash. The reasoning can be found here https://mdformat.readthedocs.io/en/stable/users/style.html#hard-line-breaks

There are many other syntaxes that mdformat converts to another style too. If it didn't do that then it wouldn't do anything really, it would simply pass through the original text.

The quote you provided refers to footnote syntax and isn't really related. Footnotes, by the way, are not actually part of the GFM spec so you'll need the mdformat-footnote plugin if you use them.