Skip to content

Commit b9dbfbe

Browse files
committed
Add syntax highlight support for <script> and <style> tags
See: #37 This commit doesn't fix the grammar but add syntax highlight support for JavaScript and CSS code inside of <script> and <style> tags.
1 parent 9359017 commit b9dbfbe

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

queries/injections.scm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,28 @@
2222
; <link href={ Routes.static_path(..) } />
2323
((expression (expression_value) @injection.content)
2424
(#set! injection.language "elixir"))
25+
26+
; Sintax highlight for style and javascript tags
27+
((tag
28+
(start_tag
29+
(tag_name) @tag_name (#eq? @tag_name "script"))
30+
(text)
31+
(end_tag)
32+
) @injection.content
33+
(#offset! @injection.content 1 0 0 -9)
34+
(#set! injection.language "javascript")
35+
(#set! injection.include-children)
36+
(#set! injection.combined)
37+
)
38+
39+
((tag
40+
(start_tag
41+
(tag_name) @tag_name (#eq? @tag_name "style"))
42+
(text)
43+
(end_tag)
44+
) @injection.content
45+
(#offset! @injection.content 1 0 0 -9)
46+
(#set! injection.language "css")
47+
(#set! injection.include-children)
48+
(#set! injection.combined)
49+
)

0 commit comments

Comments
 (0)