Skip to content

Commit

Permalink
Add DTD language support (helix-editor#6644)
Browse files Browse the repository at this point in the history
- Added syntax highlighting for the DTD subset of the XML spec.
- Included .dtd and .ent as common file extensions
  • Loading branch information
KMikeeU authored and Triton171 committed Jun 18, 2023
1 parent a210ec7 commit 8792dfb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
| diff || | | |
| dockerfile || | | `docker-langserver` |
| dot || | | `dot-language-server` |
| dtd || | | |
| edoc || | | |
| eex || | | |
| ejs || | | |
Expand Down
20 changes: 20 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,26 @@ roots = []
name = "xml"
source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "48a7c2b6fb9d515577e115e6788937e837815651" }


[[language]]
name = "dtd"
scope = "source.dtd"
injection-regex = "dtd"
file-types = ["dtd", "ent"]
indent = {tab-width = 2, unit = " "}
roots = []

[language.auto-pairs]
'(' = ')'
'[' = ']'
'"' = '"'
"'" = "'"
'<' = '>'

[[grammar]]
name = "dtd"
source = { git = "https://github.com/KMikeeU/tree-sitter-dtd", rev = "6116becb02a6b8e9588ef73d300a9ba4622e156f"}

[[language]]
name = "wit"
scope = "source.wit"
Expand Down
39 changes: 39 additions & 0 deletions runtime/queries/dtd/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
; highlights.scm

(comment) @comment

[
"ELEMENT"
"ATTLIST"
] @keyword

[
"#REQUIRED"
"#IMPLIED"
"#FIXED"
"#PCDATA"
] @keyword.directive

[
"EMPTY"
"ANY"
"SYSTEM"
"PUBLIC"
] @constant

(element_name) @module


(attribute_name) @attribute

(system_literal) @string
(pubid_literal) @string
(attribute_value) @string

[
">"
"</"
"<?"
"?>"
"<!"
] @punctuation.bracket
2 changes: 2 additions & 0 deletions runtime/queries/dtd/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

0 comments on commit 8792dfb

Please sign in to comment.