cwjohan / markdown-to-html

Command-line utility to convert Github Flavored Markdown to HTML.
MIT License
236 stars 86 forks source link

Incorrectly converts line breaks to <br> #31

Open raine opened 5 years ago

raine commented 5 years ago

Markdown in text format is often hard wrapped at some width (typically 80 characters), to maintain readability with editors that don't no soft wrapping. markdown-to-html incorrectly converts line breaks to <br /> tags.

This is not how github works, as evident in the following gist. Just compare rendered and raw versions, to see that github definitely does not interpret line breaks as <br/>.

https://gist.github.com/raine/dd9a28f763b4a61bc0f56967bb7ff56a https://gist.githubusercontent.com/raine/dd9a28f763b4a61bc0f56967bb7ff56a/raw/9d8517f1518cfb34d769eced59cce214a3889926/test.md

input

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum has been the industry's standard dummy text ever since the 1500s, when an
unknown printer took a galley of type and scrambled it to make a type specimen
book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s
with the release of Letraset sheets containing Lorem Ipsum passages, and more
recently with desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum.

output

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem<br>Ipsum has been the industry&#39;s standard dummy text ever since the 1500s, when an<br>unknown printer took a galley of type and scrambled it to make a type specimen<br>book. It has survived not only five centuries, but also the leap into electronic<br>typesetting, remaining essentially unchanged. It was popularised in the 1960s<br>with the release of Letraset sheets containing Lorem Ipsum passages, and more<br>recently with desktop publishing software like Aldus PageMaker including<br>versions of Lorem Ipsum.</p>
eih commented 4 years ago

--flavor markdown is a nasty workaround with it's own downsides:

For example, fenced code blocks don't work when using the markdown utility or the Markdown class with the --flavor markdown option.

Needs fixing IMHO

cwjohan commented 4 years ago

Yeah. I agree that's bad. Surprised that I didn't test that -- or maybe it used to work?

On Sat, May 23, 2020 at 10:29 AM Inan Hira notifications@github.com wrote:

--flavor markdown is a nasty workaround with it's own downsides:

For example, fenced code blocks don't work when using the markdown utility or the Markdown class with the --flavor markdown option.

Needs fixing IMHO

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cwjohan/markdown-to-html/issues/31#issuecomment-633101164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7GVXD4GRJCPI5Q4OWW3SLRTABWDANCNFSM4FXYUVNA .