ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Ngx HTML

by princemaple ST3

Ngx (Angular2+) HTML Syntax for SublimeText

Details

Installs

  • Total 28K
  • Win 16K
  • OS X 7K
  • Linux 5K
Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2
Windows 2 2 2 6 3 2 1 1 4 7 7 5 6 0 0 3 2 4 3 13 6 2 5 4 4 5 5 6 2 5 3 5 4 9 3 0 1 5 7 6 0 1 0 1 3 0
OS X 1 1 2 4 2 1 0 1 3 2 4 0 0 0 0 0 2 3 3 3 1 1 1 2 1 1 0 0 2 1 1 3 7 2 3 0 0 2 3 4 1 2 2 1 3 0
Linux 0 4 1 2 0 3 0 1 3 1 2 1 1 0 0 3 2 1 0 3 1 1 2 4 0 0 5 3 1 0 1 5 4 2 1 0 1 1 2 3 2 2 0 0 1 1

Readme

Source
raw.​githubusercontent.​com

Ngx (Angular2+) HTML Syntax for SublimeText

based on the official sublime html syntax

Features

So that it's not broken when there are

attributes on the tags

Plus

Highlighting the JS part as JS. So,

  • in [myBinding]="myVar", you should see myVar as an JS variable instead of string content
    • i.e. myVar should be highlighted differently from "s
  • in *ngFor="let column of columns", you should see let and of highlighted as keywords
  • in (change)="update()", you should see update as function name
  • in a && b within an Angular expression, you should see && correctly highlighted as the JS operator instead of an error you would see in normal HTML syntax.
  • in {{1 + 2}} interpolations, you should see JS syntax highlighting as well

How to use

The syntax is listed as Ngx HTML in Sublime syntax selection list.

I personaly use ApplySyntax plugin with the following setting:

"syntaxes": [
    {
        "syntax": "Ngx HTML/NgxHTML",
        "extensions": ["component.html"],
    },
]

You could use it in other ways… e.g. set it as the default syntax for all html files, since it's a superset of the html syntax anyway.