Add syntax highlighting to code editors
This commit is contained in:
58
crates/bds-editor/syntaxes/Liquid.sublime-syntax
Normal file
58
crates/bds-editor/syntaxes/Liquid.sublime-syntax
Normal file
@@ -0,0 +1,58 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
name: Liquid
|
||||
file_extensions:
|
||||
- liquid
|
||||
scope: text.html.liquid
|
||||
contexts:
|
||||
main:
|
||||
- match: '\{\{-?'
|
||||
scope: punctuation.section.embedded.begin.liquid
|
||||
push: liquid-output
|
||||
- match: '\{%-?\s*comment\b[^%]*-?%\}'
|
||||
scope: comment.block.liquid
|
||||
push: liquid-comment
|
||||
- match: '\{%-?'
|
||||
scope: punctuation.section.embedded.begin.liquid
|
||||
push: liquid-tag
|
||||
- include: scope:text.html.basic
|
||||
|
||||
liquid-output:
|
||||
- meta_scope: meta.embedded.liquid
|
||||
- match: '-?\}\}'
|
||||
scope: punctuation.section.embedded.end.liquid
|
||||
pop: true
|
||||
- include: liquid-values
|
||||
|
||||
liquid-tag:
|
||||
- meta_scope: meta.embedded.liquid
|
||||
- match: '-?%\}'
|
||||
scope: punctuation.section.embedded.end.liquid
|
||||
pop: true
|
||||
- match: '\b(assign|capture|case|comment|cycle|decrement|echo|elsif|else|endcase|endcapture|endif|endfor|endunless|endcomment|for|if|include|increment|liquid|paginate|raw|render|tablerow|unless|when)\b'
|
||||
scope: keyword.control.liquid
|
||||
- match: '[><=!]=?|\.|:'
|
||||
scope: keyword.operator.liquid
|
||||
- include: liquid-values
|
||||
|
||||
liquid-values:
|
||||
- match: '\|\s*[a-zA-Z_][\w-]*'
|
||||
scope: support.function.filter.liquid
|
||||
- match: '\b(true|false|nil|blank|empty|contains)\b'
|
||||
scope: constant.language.liquid
|
||||
- match: '\b\d+(\.\d+)?\b'
|
||||
scope: constant.numeric.liquid
|
||||
- match: '"([^"\\]|\\.)*"'
|
||||
scope: string.quoted.double.liquid
|
||||
- match: "'([^'\\\\]|\\\\.)*'"
|
||||
scope: string.quoted.single.liquid
|
||||
- match: '[a-zA-Z_][\w.-]*'
|
||||
scope: variable.other.liquid
|
||||
- match: '[,()\[\]]'
|
||||
scope: punctuation.separator.liquid
|
||||
|
||||
liquid-comment:
|
||||
- meta_scope: comment.block.liquid
|
||||
- match: '\{%-?\s*endcomment\s*-?%\}'
|
||||
scope: comment.block.liquid
|
||||
pop: true
|
||||
@@ -0,0 +1,53 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
name: Markdown with Macros
|
||||
file_extensions:
|
||||
- bds-md
|
||||
scope: text.html.markdown.bds
|
||||
contexts:
|
||||
main:
|
||||
- match: '\[\[[a-zA-Z][\w-]*'
|
||||
scope: keyword.control.macro.bds
|
||||
push: macro-parameters
|
||||
- match: '^#{1,6}\s.*$'
|
||||
scope: keyword.control.heading.markdown
|
||||
- match: '^\s*>+'
|
||||
scope: string.quoted.block.markdown
|
||||
- match: '^\s*[-+*]\s'
|
||||
scope: keyword.control.list.unnumbered.markdown
|
||||
- match: '^\s*\d+\.\s'
|
||||
scope: keyword.control.list.numbered.markdown
|
||||
- match: '^\s*```\w*'
|
||||
scope: keyword.control.code-fence.markdown
|
||||
push: fenced-code
|
||||
- match: '\*\*[^*]+\*\*|__[^_]+__'
|
||||
scope: entity.name.function.strong.markdown
|
||||
- match: '\*[^*]+\*|_[^_]+_'
|
||||
scope: string.quoted.emphasis.markdown
|
||||
- match: '`[^`]+`'
|
||||
scope: string.quoted.inline-code.markdown
|
||||
- match: '!?\[[^\]]*\]\([^)]*\)'
|
||||
scope: string.quoted.link.inline.markdown
|
||||
- match: '!?\[[^\]]*\]\[[^\]]*\]'
|
||||
scope: string.quoted.link.reference.markdown
|
||||
|
||||
macro-parameters:
|
||||
- meta_scope: meta.macro.bds
|
||||
- match: '\]\]'
|
||||
scope: keyword.control.macro.bds
|
||||
pop: true
|
||||
- match: '[a-zA-Z][\w-]*(?=\s*=)'
|
||||
scope: entity.other.attribute-name.bds
|
||||
- match: '='
|
||||
scope: punctuation.separator.key-value.bds
|
||||
- match: '"[^"\n]*"'
|
||||
scope: string.quoted.double.bds
|
||||
- match: '\s+'
|
||||
- match: '[^\]"=\s]+'
|
||||
scope: string.unquoted.attribute-value.bds
|
||||
|
||||
fenced-code:
|
||||
- meta_scope: string.unquoted.code-block.markdown
|
||||
- match: '^\s*```\s*$'
|
||||
scope: keyword.control.code-fence.markdown
|
||||
pop: true
|
||||
Reference in New Issue
Block a user