Rosey/markdown-draft-js

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

Opened this issue · 2 comments

Rosey commented

See failing test here: 71b848b

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

I have the same problem. Is there some solution?

Rosey commented

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!