It's a pretty simple issue with a pretty simple fix, but I thought you might want to work the fix into your code to save someone else the trouble of figuring out what's wrong. A simple regexp replace is sufficient.
text = text.replace(/\r\n|\r|\n/g, '\n');
If nothing else, it would be nice if it was documented that carriage returns cause problems.
Fixes #8 - filter carriage returns before highlighting