1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
filetype: html
detect:
filename: "\\.htm[l]?$"
rules:
# Doctype is case-insensitive
- preproc: "<!(?i)(DOCTYPE html.*)>"
# Opening tag
- symbol.tag:
start: "<(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|bdi|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|main|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|section|select|small|source|span|strike|strong|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr)\\b"
end: ">"
rules:
- identifier: "\\b(placeholder|style|alt|bgcolor|height|href|id|(aria|data)\\-.+|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width|class|charset|content|rel|integrity|crossorigin|for|onsubmit|lang|role)\\b"
- special: "\\b(required)\\b"
# Match double-quote strings
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string.url: "((ftp(s)?|http(s)?|git|chrome)://[^\\s]+)"
# Match single-quote strings
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string.url: "((ftp(s)?|http(s)?|git|chrome)://[^\\s]+)"
# Highlight the equals and any colon between words
- symbol: "\\b(=|:\\b)"
# Closing tag
- symbol.tag:
start: "</(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|bdi|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|main|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|section|select|small|source|span|strike|strong|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr)\\b"
end: ">"
rules:
# Anything in the closing tag is an error
- error: "."
# Reserved entities like a and Ī
- special: "(([a-zA-Z]&#[0-9]+|&[a-zA-Z]+|&#[a-zA-Z0-9]+);)"
# TODO: Add `limit-rules` to both the `default` rules below once it's implemented into Micro
- default:
start: "<script.*?>"
end: "</script.*?>"
limit-group: symbol.tag
rules:
- include: "javascript"
- default:
start: "<style.*?>"
end: "</style.*?>"
limit-group: symbol.tag
rules:
- include: "css"
# This weird empty comment thing is technically valid
- comment: "<!>"
- comment.block:
start: "<!\\-\\-"
end: "\\-\\->"
rules:
- todo: "(FIXME|NOTE|TODO):?"
# While technically not a "true" error, these are recommended to not be used inside a comment
- error: "(\\-\\-|>)"
|