Closed jxodwyer closed 8 years ago
Hi @jxodwyer. I don't think this is a bug. Whenever you press enter in Draft you create a new block (even though the blocks in your case have no margin so it looks like a single block with multiple lines). The closest equivalent to a plain-text block in Markdown is a paragraph. Paragraphs in Markdown should have two linebreaks between them. A single linebreak would cause a markdown parser will swallow the linebreak completely.
This behavior is by design, it's not a bug.
So, if I understand your problem correctly, you want to condense consecutive unstyled blocks into a single block with soft-breaks. I'd suggest doing this as a pre-process step before converting to Markdown.
When hitting enter for a new line it seems like an extra line is appended to the output from the stateToMarkdown module. Below is a screenshot consoling out
stateToMarkdown(editorState.getCurrentContent())
. As you can see in the console there is an added space between each of the breaks which is not seen in the draft.js editor itself. @sstur feel free to hit me back on slack. Like I mentioned I'd be happy to work through this with you and help out as much as possible.