markdown-draft-js icon indicating copy to clipboard operation
markdown-draft-js copied to clipboard

markdown-to-draft: multi-line block quotes are squashed when preserveNewlines is `true`

Open Rosey opened this issue 5 years ago • 2 comments

See failing test here: https://github.com/Rosey/markdown-draft-js/pull/107/commits/71b848bf9e7c1b3ed123643d2bd6095e9ecce5b0

Would only be an issue for people using preserveNewlines: true as by default stripping those newlines is correct markdown behaviour.

However, we have a hack around preserving newlines when the option is turned on, and in this case it isn't working correctly. The case being where we have one single block quote with blank lines in between text.

Something like this for draft js should be generated for blank lines -

> test
>
>
>
> hello!

but instead we end up with something like

> test
> hello

Rosey avatar Oct 09 '19 17:10 Rosey

I have the same problem. Is there some solution?

petrmarecek avatar Oct 25 '19 14:10 petrmarecek

A solution needs to be written, it's a bit tricky but doable. remarkable exposes the number of "lines" as a variable even though it strips them so we'd need to update the parser to read the difference between line numbers and then re-add the newlines in. We do this already with regular paragraphs.

Seems straightforward enough but there are some gotchas that I encountered when I tried to do a hot fix so I put it off until I have more time to think about it properly. If anyone else wants to tackle they can also feel free of course!

Rosey avatar Oct 25 '19 16:10 Rosey