Apostrophes within a script break the syntax highlighting thereafter
jamesl1001 opened this issue · 6 comments
For anyone wanting a temporary workaround for this issue, escape the apostrophe with '
.
Hey @jamesl1001,
Really sorry for not replying anything yet, I did manage to reproduce the error, but won't get around to have a go at fixing it until next week the earliest – I have a two weeks old newborn next to me and will speak at re:develop conference this Friday...
Well, even though I remember seeing this issue happening, now embarrassingly I can't reproduce again. Would you mind pasting a full reproduction here?
Also, just realised you're using type="x-tmpl-handlebars"
, any particular reason for that? Since the script tag can contain different stuff, any type which should be treated as Handlebars needs to be whitelisted, otherwise it'll be rendered as however the text editor's default HTML package would treat it. The current whitelist is: (?:text/x-handlebars-template|text/x-handlebars|text/template)
.
Ahh yes, the script type was the problem!
I've tested all three types from your whitelist and they all handle the apostrophe perfectly.
The reason I was using type="x-tmpl-handlebars"
was because half way through development, I switched from using Mustache. In their documentation they use type="x-tmpl-mustache"
, so I simply changed 'mustache' thinking nothing of it!
Maybe it would be an idea to add this script type to the whitelist to catch this edge case for anyone who migrates from Mustache to Handlebars in the future?
I have opened PR #70 above if you would like to make this change :)
Of course it's fine adding this, I just merged your PR and created a new version, so the update should be live both for Atom and Sublime.
Thanks for taking your time to create a PR!
Brilliant! Just checked it in Sublime Text 3 and it's working just fine!