monospaced / sublime-twee

Twee syntax highlighting for Sublime Text 2.
8 stars 3 forks source link

Javascript highlighting within <<script>> tags #2

Open JordanMagnuson opened 8 years ago

JordanMagnuson commented 8 years ago

Javascript is currently highlighted within [script] tagged passages (which is awesome), but not within normal passage <<script>> blocks. See screenshot: http://i.imgur.com/8Q4v4M8.png

monospaced commented 8 years ago

The highlighter expects the << >> syntax to contain a twee expression inside the arrow braces, and has special highlighting for that, e.g.:

screen shot 2016-09-21 at 17 43 57

Unfortunately that makes it tricky to also have <<script>> tags acts as a 'marker' for a javascript block. I don't think I realised this was even a valid syntax?

Glad you're getting some use out of this little project, and thanks for the contributions 👍

JordanMagnuson commented 8 years ago

Thanks for the reply! Ah yes, I believe this is a feature of the Sugarcube 2 story format. See here. Basically it's a macro/tag that allows you to insert pure javascript inline within any passage, not just those tagged with 'script,' which is a very handy feature when you want to run a quick bit of code from any given passage. I use this feature frequently for things like this:

<<script>>
    if (!sndShouting.playing()) {
        sndShouting.play();
    } 
<</script>>

My passages thus end up peppered with javascript, but all of the js just shows up white with the current syntax highlighting, which makes it hard to tell what's going on.

Would be awesome if you could add support for this, since Sugarcube is one of the most-utilized and best-supported story formats going right now. Thanks for the consideration!