jbt / markdown-editor

Live (Github-flavored) Markdown Editor
http://jbt.github.com/markdown-editor
ISC License
2.82k stars 643 forks source link

Fixed bug in `markdown-it.js` hard line break handler #108

Closed austinmm closed 1 year ago

austinmm commented 4 years ago

This pull request fixes the bug that was pointed out by open issue #47.

aero31aero commented 4 years ago

Thanks for submitting this. There are two reasons I'm skeptical about this PR:

  1. This would result in adding to <br> tags each time we have a hardbreak. Also, this would make the xhtml and the html variants inconsistent.
  2. GFM and markdown-it agree on the output here.

This is a good point to discuss: should we go by what github seemingly implements on the website or what they claim their implementation of markdown does?

austinmm commented 4 years ago

Hello @aero31aero, thank you for your thoughtful breakdown. \ I believe I addressed the bug you pointed out in your first bullet with my newest commit. \ I understand your hesitations pointed out in your second bullet. I don't know if I have a right answer to that question. There doesn't seem to be clear documentation of how to format this input in GitHub's complete GFM Spec documentation. I believe that is why babelmark:
converts...

hello
\
world

to...

<p>
  hello
  <br>
   world
</p>

and not (like GitHub actuallydoes)...

<p>
  hello
  <br>
  <br>
   world
</p>