Sublime Forum

ST4 Syntax applied inside a block

#1

I would like to apply certain syntax rules inside a block defined by “–text”:

--text
Formatted text
--

Other text

--form
Other text
--

I have seen that push and pop are considered overcomplex in ST4. And I would prefer to have all the rules inside the same .sublime-syntax file, not using embed to reference an external file.

I tried this but it does not work :slight_smile:

   - match: ^--text$
     scope: myblock
     escape: (?=--$)

 myblock:
 - match: [a-zA-Z]
   scope: charstyle
 - match [0-9]
   scope: digitstyle

But it gives an idea of what I am trying to do. Just define like a “context” to define new rules that apply only inside that context. The --text trigger is only for the block, but the escape symbols can appear in some other parts of the document.

How can I achieve this? Thanks!

0 Likes

#2

since you want to use escape, change to embed: myblock?
escape is paired with embed as mentioned in its doc.

1 Like