Skip to content

Commit

Permalink
[HTML] Add support for 'text/babel' MIME type (#3652)
Browse files Browse the repository at this point in the history
This commit adds `text/babel` to the list of supported MIME types to
enable JavaScript highlighting within <script type="text/babel"> tags.

see: vuejs/vue-syntax-highlight#218
  • Loading branch information
deathaxe authored Feb 3, 2023
1 parent 80371bb commit bcff768
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HTML/HTML.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ variables:
javascript_mime_type: |-
(?xi:
(?:
# default JS MIME types
# https://mimesniff.spec.whatwg.org/#javascript-mime-type
(?:application|text)/(?:x-)?(?:java|ecma)script
| text/javascript1\.[0-5]
| text/jscript
| text/livescript
# non-standard JS MIME types
| text/babel
)
{{mime_type_parameters}}?
)
Expand Down
5 changes: 5 additions & 0 deletions HTML/syntax_test_html.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
## ^^^^^^^^^ meta.tag.script.end.html - source.js.embedded.html
## ^ - meta.tag

<script type="text/babel">var foo</script>
## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.script.begin.html
## ^^^^^^^ source.js.embedded.html
## ^^^^^^^^^ meta.tag.script.end.html

<script type="text/javascript"> <!--
##^^^^^^ meta.tag.script.begin.html - meta.tag meta.tag - meta.attribute-with-value - source
## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.script.begin.html meta.attribute-with-value.html - meta.tag meta.tag - meta.attribute-with-value meta.attribute-with-value - source
Expand Down

0 comments on commit bcff768

Please sign in to comment.