Sublime Forum

[SOLVED] Help With HTML Syntax Highlighting in EML Syntax Package

#1

The package EML Syntax now has an error after the most recent Sublime Text version update:

error: Error loading syntax file "Packages/EML Syntax/eml.sublime-syntax": Apparent recursion within a with_prototype action: 25000 context sanity limit hit

This is what is causing the error:

    #pull in HTML for the HTML body of the message
    - match: (?i)<(!DOCTYPE\s*)?html
      push: Packages/HTML/HTML.sublime-syntax
      with_prototype:
        - match: (?=</html>)
          pop: true

Here is my fix which seems to work to 90%:

    #pull in HTML for the HTML body of the message
    - match: (?i)<(!DOCTYPE\s*)?html
      scope: meta.tag.html
      push:
        - meta_include_prototype: false
        - match: (?i)</html>
          pop: true
        - include: Packages/HTML/HTML.sublime-syntax

The only problem left is that the <html> tags are not being colored, but the rest of the html is being correctly colored.

image

I think I have made a mistake in the scope or maybe somewhere else. Any ideas for how to fix this last little problem?

The syntax is here:

0 Likes

#2

h/t to @deathaxe for the better solution:

    - match: (?=(?i:<(!DOCTYPE\s*)?html))
      push:
        - match: (</)(html)\s*(>)
          scope: meta.tag.structure.any.html
          captures:
            1: punctuation.definition.tag.begin.html
            2: entity.name.tag.structure.any.html
            3: punctuation.definition.tag.end.html
          pop: true
        - include: Packages/HTML/HTML.sublime-syntax
0 Likes