I'm getting
Uncaught SyntaxError: Unexpected token ILLEGAL
And I checked that because of this
currentMd: '<div>#hehe
</div>'
The two extra new line that is in the currentMd breaking it, so how can I instead replacing that new lines with \n ??
So it will be like this instead
currentMd: '<div>#hehe\n\n</div>'
In javascript or jQuery would be fine.
It may be not clear that the content is actually just an example here.
The actual content is being retrieved from a database, so in the database there I won't have control and the user will always press enter anyway.
I might have not been very clear on my question here.
The thing is that this content that being assign to contentMd it is being retrieved from nodejs which I have no control on what is going in there.
What about:
var your_content = "<div>#hehe\
\
\
</div>";
var replaced_text = your_content.replace(/\n|\s/g, "");
Go into your text editor and replace the line breaks by hand. Unless this code is computer-generated, or you somehow managed to make this bug in thousands of lines of code before catching it, that should be good enough.
That's exactly how you do it:
> '<div>#hehe\n\n</div>'
"<div>#hehe
</div>"