Rosey / markdown-draft-js

A tool to convert content created in DraftJS to markdown and vice versa.
https://rosey.github.io/markdown-draft-js/
MIT License
318 stars 69 forks source link

Make markdown escaping in draft-to-markdown much smarter #98

Closed Rosey closed 5 years ago

Rosey commented 5 years ago

🤮 I hate how crazy this got but maybe it's not as bad as I think...

Basically we were seeing an issue where when a user pasted a link in, the "markdown" characters were being escaped, even though they were not actually valid markdown characters because they weren't in the right context.

Like _ is a markdown character, but if there's no matching closing character, it doesn't need to be escaped.

Similarily, when a markdown character is like this: h_a_h it shouldn't be escaped because markdown dictates there needs to be whitespace.

I was hoping this issue wasn't a big deal and wanted to ignore it, but the issue with the links was too big to ignore.