Two possible solutions:
- Keep JavaScript code in separate files. Clean way in general but not suitable for very short scripts.
- Hack the editor! Maybe there's a simple way to change the script detection of the highlighter.
Of course you may alter the headScript helper but it works in a correct way and this is in fact an editor issue.