---
name: HTML
fileTypes:
- html
- htm
- shtml
- xhtml
- phtml
- php
- inc
- tmpl
- tpl
firstLineMatch:
- name: source.php.embedded.block.html
begin: (?:^\s*)(?=<\?(?i:php|=)?(?!.*\?>))
applyEndPatternLast: 1
end: (?<=\?>)(?:\s*$\n)?
patterns:
- include: source.php
comment: match only multi-line PHP with leading whitespace
- name: source.php.embedded.line.html
begin: (?=<\?(?i:php|=)?)
applyEndPatternLast: 1
end: (?<=\?>)
patterns:
- include: source.php
entities:
patterns:
- name: constant.character.entity.html
captures:
"1":
name: punctuation.definition.entity.html
"3":
name: punctuation.definition.entity.html
match: (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)
- name: invalid.illegal.bad-ampersand.html
match: "&"
string-single-quoted:
name: string.quoted.single.html
endCaptures:
"0":
name: punctuation.definition.string.end.html
begin: "'"
beginCaptures:
"0":
name: punctuation.definition.string.begin.html
end: "'"
patterns:
- include: "#embedded-code"
- include: "#entities"
python:
name: source.python.embedded.html
begin: (?:^\s*)<\?python(?!.*\?>)
end: \?>(?:\s*$\n)?
patterns:
- include: source.python
tag-id-attribute:
name: meta.attribute-with-value.id.html
captures:
"1":
name: entity.other.attribute-name.id.html
"2":
name: punctuation.separator.key-value.html
begin: \b(id)\b\s*(=)
end: (?<='|")
patterns:
- name: string.quoted.double.html
endCaptures:
"0":
name: punctuation.definition.string.end.html
begin: "\""
contentName: meta.toc-list.id.html
beginCaptures:
"0":
name: punctuation.definition.string.begin.html
end: "\""
patterns:
- include: "#embedded-code"
- include: "#entities"
- name: string.quoted.single.html
endCaptures:
"0":
name: punctuation.definition.string.end.html
begin: "'"
contentName: meta.toc-list.id.html
beginCaptures:
"0":
name: punctuation.definition.string.begin.html
end: "'"
patterns:
- include: "#embedded-code"
- include: "#entities"
tag-generic-attribute:
name: entity.other.attribute-name.html
match: \b([a-zA-Z\-:]+)
ruby:
patterns:
- name: comment.block.erb
captures:
"0":
name: punctuation.definition.comment.erb
begin: <%+#
end: "%>"
- name: source.ruby.embedded.html
captures:
"0":
name: punctuation.section.embedded.ruby
begin: <%+(?!>)=?
end: -?%>
patterns:
- name: comment.line.number-sign.ruby
captures:
"1":
name: punctuation.definition.comment.ruby
match: (#).*?(?=-?%>)
- include: source.ruby
- name: source.ruby.nitro.embedded.html
captures:
"0":
name: punctuation.section.embedded.ruby.nitro
begin: <\?r(?!>)=?
end: -?\?>
patterns:
- name: comment.line.number-sign.ruby.nitro
captures:
"1":
name: punctuation.definition.comment.ruby.nitro
match: (#).*?(?=-?\?>)
- include: source.ruby
smarty:
patterns:
- captures:
"1":
name: source.smarty.embedded.html
"2":
name: support.function.built-in.smarty
begin: (\{(literal)\})
end: (\{/(literal)\})
- name: source.smarty.embedded.html
begin: "{{|{"
end: "}}|}"
disabled: 1
patterns:
- include: source.smarty
embedded-code:
patterns:
- include: "#ruby"
- include: "#php"
- include: "#smarty"
- include: "#python"
uuid: 17994EC8-6B1D-11D9-AC3A-000D93589AF6
foldingStartMarker: |-
(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\b.*?>
|)$
|<\?(?:php)?.*\b(if|for(each)?|while)\b.+:
|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
)
patterns:
- name: meta.tag.any.html
endCaptures:
"1":
name: punctuation.definition.tag.html
"2":
name: meta.scope.between-tag-pair.html
"3":
name: entity.name.tag.html
"4":
name: punctuation.definition.tag.html
begin: (<)([a-zA-Z0-9:]+)(?=[^>]*>\2>)
beginCaptures:
"1":
name: punctuation.definition.tag.html
"2":
name: entity.name.tag.html
end: (>(<)/)(\2)(>)
patterns:
- include: "#tag-stuff"
- name: meta.tag.preprocessor.xml.html
captures:
"1":
name: punctuation.definition.tag.html
"2":
name: entity.name.tag.xml.html
begin: (<\?)(xml)
end: (\?>)
patterns:
- include: "#tag-generic-attribute"
- include: "#string-double-quoted"
- include: "#string-single-quoted"
- name: comment.block.html
captures:
"0":
name: punctuation.definition.comment.html
begin: $
|<\?(?:php)?.*\bend(if|for(each)?|while)\b
|\{\{?/(if|foreach|capture|literal|foreach|php|section|strip)
|^[^{]*\}
)
keyEquivalent: ^~H