diff --git a/.gitignore b/.gitignore index fc2bb20..e43b0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ .DS_Store -sample.vue diff --git a/README.md b/README.md index e49c74e..0ab3250 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ # Vue Syntax Highlight +**Note:** The `master` branch hosts the `tmLanguage` based implementation that is distributed to Sublime Text build < 3153. It is also used to power GitHub's syntax highlight of `*.vue` files in [linguist](https://github.com/github/linguist). + +For a newer implementation of the syntax that is distributed to build >=3153, See the [new](https://github.com/vuejs/vue-syntax-highlight/tree/new) branch. + +--- + Sublime Text Syntax highlighting for single-file [Vue.js](http://vuejs.org) components (enabled by [vue-loader](https://github.com/vuejs/vue-loader) or [vueify](https://github.com/vuejs/vueify)). -![screenshot](https://cloud.githubusercontent.com/assets/499550/11458853/99ed23aa-9696-11e5-9bf6-43c706487aee.png) +![screenshot](https://raw.githubusercontent.com/vuejs/vue-syntax-highlight/new/samples/screenshot.png) ### Install - Via Package Control: search for `Vue Syntax Highlight`. - Manual: clone this repo into your Sublime `Packages` folder. -**NOTE:** You still need to install corresponding packages for pre-processors (e.g. Jade, SASS, CoffeeScript) to get proper syntax highlighting for them. +**Additional Installation Requirements:** In order to get proper syntax highlighting for pre-processors (e.g. Jade, SASS, CoffeeScript) you will also need to install the corresponding packages for each of them. ### Enabling JSX Highlighting diff --git a/samples/arrow.vue b/samples/arrow.vue new file mode 100644 index 0000000..29d0a6b --- /dev/null +++ b/samples/arrow.vue @@ -0,0 +1,8 @@ + + + diff --git a/samples/basic.vue b/samples/basic.vue new file mode 100644 index 0000000..3c7d521 --- /dev/null +++ b/samples/basic.vue @@ -0,0 +1,34 @@ + + + + + + + diff --git a/samples/langs.vue b/samples/langs.vue new file mode 100644 index 0000000..b96fc7c --- /dev/null +++ b/samples/langs.vue @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/vue.YAML-tmLanguage b/vue.YAML-tmLanguage index 2a622a8..3c8888f 100644 --- a/vue.YAML-tmLanguage +++ b/vue.YAML-tmLanguage @@ -64,7 +64,7 @@ patterns: match: (\s*)(?!--|>)\S(\s*) - name: text.slm.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]slm(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])slm\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -80,7 +80,7 @@ patterns: - include: text.slm - name: text.jade.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]jade(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])jade\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -96,7 +96,7 @@ patterns: - include: text.jade - name: text.pug.embedded.html - begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]pug(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])pug\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -113,7 +113,7 @@ patterns: - name: source.stylus.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]stylus(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])stylus\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -129,7 +129,7 @@ patterns: - include: source.stylus - name: source.postcss.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]postcss(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])postcss\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -145,7 +145,7 @@ patterns: - include: source.postcss - name: source.sass.embedded.html - begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:sass)(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])sass\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -159,10 +159,9 @@ patterns: end: (?=]*lang=['"](?:scss)(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])scss\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -175,12 +174,10 @@ patterns: '1': {name: punctuation.definition.tag.end.html} end: (?=]*lang=['"]less(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])less\1?) end: ()(?:\s*\n)? captures: '1': {name: punctuation.definition.tag.begin.html} @@ -193,7 +190,7 @@ patterns: '1': {name: punctuation.definition.tag.end.html} end: (?=]*/>) @@ -211,8 +208,26 @@ patterns: patterns: - include: source.css +- name: source.ts.embedded.html + begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])ts\1?) + beginCaptures: + '1': {name: punctuation.definition.tag.begin.html} + '2': {name: entity.name.tag.script.html} + end: (?<=)(?:\s*\n)? + endCaptures: + '2': {name: punctuation.definition.tag.html} + patterns: + - include: '#tag-stuff' + - begin: (?) + end: (]*lang=['"]coffee(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])coffee\1?) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} @@ -230,7 +245,7 @@ patterns: - include: source.coffee - name: source.livescript.embedded.html - begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]livescript(?:\?[^"]*)?['"]) + begin: (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])livescript\1?) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} @@ -248,7 +263,7 @@ patterns: - include: source.livescript - name: source.js.embedded.html - begin: (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel).*))) + begin: (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel|ecmascript).*))) beginCaptures: '1': {name: punctuation.definition.tag.begin.html} '2': {name: entity.name.tag.script.html} diff --git a/vue.tmLanguage b/vue.tmLanguage index 7bc2850..a8bdbeb 100644 --- a/vue.tmLanguage +++ b/vue.tmLanguage @@ -211,7 +211,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]slm(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])slm\1?) captures 1 @@ -265,7 +265,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]jade(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])jade\1?) captures 1 @@ -319,7 +319,7 @@ begin - (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=['"]pug(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:template))\b(?=[^>]*lang=(['"])pug\1?) captures 1 @@ -373,7 +373,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]stylus(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])stylus\1?) captures 1 @@ -427,7 +427,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]postcss(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])postcss\1?) captures 1 @@ -481,7 +481,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:sass)(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])sass\1?) captures 1 @@ -529,17 +529,13 @@ include source.sass - - include - source.scss - begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"](?:scss)(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])scss\1?) captures 1 @@ -585,11 +581,7 @@ include - source.sass - - - include - source.scss + source.css.scss @@ -597,7 +589,7 @@ begin - (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=['"]less(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:style))\b(?=[^>]*lang=(['"])less\1?) captures 1 @@ -643,7 +635,7 @@ include - source.less + source.css.less @@ -705,7 +697,69 @@ begin - (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]coffee(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])ts\1?) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (?<=</(script|SCRIPT))(>)(?:\s*\n)? + endCaptures + + 2 + + name + punctuation.definition.tag.html + + + name + source.ts.embedded.html + patterns + + + include + #tag-stuff + + + begin + (?<!</(?:script|SCRIPT))(>) + captures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.script.html + + + end + (</)((?i:script)) + patterns + + + include + source.ts + + + + + + + begin + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])coffee\1?) beginCaptures 1 @@ -767,7 +821,7 @@ begin - (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=['"]livescript(?:\?[^"]*)?['"]) + (?:^\s+)?(<)((?i:script))\b(?=[^>]*lang=(['"])livescript\1?) beginCaptures 1 @@ -829,7 +883,7 @@ begin - (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel).*))) + (<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript|babel|ecmascript).*))) beginCaptures 1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy