HTML BR converting to backslash in Markdown


I’m having a problem with HTML BRs being turned into backslashes.

That is if I do this:

this.editor.setContent( "<br>", "html" );
var something = this.editor.getContent( "markdown" );

“something” is then equal to “”. I may be doing something obviously wrong but if so I can’t find it. Is this something anyone else has come across? This is from 0.3.0 via npm.


This is one of the ways in which CommonMark represents hard breaks (see here).

Aha! OK that makes sense thanks.

In that case there’s a secondary issue, which is how I noticed this in the first place. If there are two BRs in a row you end up with \\ as the markdown output (as viewed in Firefox dev tools) but when the object containing that is stringified it comes out as “\\\n\\\n”, implying that FF dev tools isn’t showing the newlines. De-stringifying this and putting back into Prosemirror gives me a newline and a backslash (visible in the editor).

(Edited to fix escaping, the irony…)