markdown-editor icon indicating copy to clipboard operation
markdown-editor copied to clipboard

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

Open austinmm opened this issue 5 years ago • 2 comments

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

austinmm avatar Oct 24 '19 08:10 austinmm

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?

aero31aero avatar Oct 25 '19 16:10 aero31aero

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>

austinmm avatar Oct 26 '19 00:10 austinmm