Skip to content

Commit 1bf584f

Browse files
committed
Add support for interpolated frontmatter
Adds front matter support to HTML and tweaks Markdown frontmatters.
1 parent ac93300 commit 1bf584f

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

Syntaxes/HTML/HTML (Jinja).sublime-syntax

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,28 @@ contexts:
3333
- include: Text (Jinja).sublime-syntax
3434

3535
main:
36-
- meta_prepend: true
36+
- meta_include_prototype: false
3737
- meta_scope: meta.template.jinja
38+
- match: ''
39+
push: [html, frontmatter]
40+
41+
frontmatter:
42+
- meta_include_prototype: false
43+
- match: \s*(---)\s*\n
44+
captures:
45+
0: meta.frontmatter.jinja
46+
1: punctuation.section.frontmatter.begin.jinja
47+
2: constant.other.language-name.jinja
48+
embed: scope:source.yaml.jinja
49+
embed_scope: meta.frontmatter.jinja source.yaml.embedded.jinja
50+
escape: ^\s*(---)\s*$\n?
51+
escape_captures:
52+
0: meta.frontmatter.jinja
53+
1: punctuation.section.frontmatter.end.jinja
54+
pop: 1
55+
# Ensure to highlight frontmatter if the syntax is embedded, but pop as early as possible
56+
- match: ^|(?=\S)
57+
pop: 1
3858

3959
###[ CUSTOM HTML ]############################################################
4060

Syntaxes/Markdown/Markdown (Jinja).sublime-syntax

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,27 @@ contexts:
2525
- include: Text (Jinja).sublime-syntax#jinja-expression-tags
2626

2727
main:
28-
- meta_prepend: true
28+
- meta_include_prototype: false
2929
- meta_scope: meta.template.jinja
30+
- match: ''
31+
push: [markdown, frontmatter]
32+
33+
frontmatter:
34+
- match: \s*(---)\s*\n
35+
captures:
36+
0: meta.frontmatter.jinja
37+
1: punctuation.section.frontmatter.begin.jinja
38+
2: constant.other.language-name.jinja
39+
embed: scope:source.yaml.jinja
40+
embed_scope: meta.frontmatter.jinja source.yaml.embedded.jinja
41+
escape: ^\s*(---)\s*$\n?
42+
escape_captures:
43+
0: meta.frontmatter.jinja
44+
1: punctuation.section.frontmatter.end.jinja
45+
pop: 1
46+
# Ensure to highlight frontmatter if the syntax is embedded, but pop as early as possible
47+
- match: ^|(?=\S)
48+
pop: 1
3049

3150
html-content:
3251
- include: HTML (Jinja).sublime-syntax#html

0 commit comments

Comments
 (0)