Richtypo removes non-breaking spaces in the original text
Closed this issue · 1 comments
arturi commented
- Consider text like this:
обзор автомобиля Tesla
I've put a non-breaking space betweenавтомобиля
andTesla
so that it would always end up on the same line. - Rychtypo parses the text, adds
where it thinks is appropriate and completely removes the original ones I've put there.
Here is more on why invisible non-breaking space characters are cool: http://destroytoday.com/findings/fix-widows-with-non-breaking-spaces/
arturi commented
Turns out, it was not Richtypo but Marked markdown parser (Lexer inside it) that removed the non-breaking space:
Lexer.prototype.lex = function(src) {
src = src
.replace(/\r\n|\r/g, '\n')
.replace(/\t/g, ' ')
.replace(/\u00a0/g, ' ')
.replace(/\u2424/g, '\n');
return this.token(src, true);
};
This is where the devil hides: .replace(/\u00a0/g, ' ').
Sorry for the trouble.