Skip to content

Commit

Permalink
Add syntax highlight support for <script> and <style> tags
Browse files Browse the repository at this point in the history
See: phoenixframework#37
This commit doesn't fix the grammar but add syntax highlight support for
JavaScript and CSS code inside of <script> and <style> tags.
  • Loading branch information
fcaldera committed Dec 15, 2024
1 parent 9359017 commit b9dbfbe
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions queries/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,28 @@
; <link href={ Routes.static_path(..) } />
((expression (expression_value) @injection.content)
(#set! injection.language "elixir"))

; Sintax highlight for style and javascript tags
((tag
(start_tag
(tag_name) @tag_name (#eq? @tag_name "script"))
(text)
(end_tag)
) @injection.content
(#offset! @injection.content 1 0 0 -9)
(#set! injection.language "javascript")
(#set! injection.include-children)
(#set! injection.combined)
)

((tag
(start_tag
(tag_name) @tag_name (#eq? @tag_name "style"))
(text)
(end_tag)
) @injection.content
(#offset! @injection.content 1 0 0 -9)
(#set! injection.language "css")
(#set! injection.include-children)
(#set! injection.combined)
)

0 comments on commit b9dbfbe

Please sign in to comment.