mirror of
https://github.com/imezx/Warp.git
synced 2025-04-25 15:40:02 +00:00
20 lines
21 KiB
JavaScript
20 lines
21 KiB
JavaScript
|
import markdown from './markdown.mjs';
|
||
|
import yaml from './yaml.mjs';
|
||
|
|
||
|
const lang = Object.freeze({ "displayName": "MDC", "injectionSelector": "L:text.html.markdown", "name": "mdc", "patterns": [{ "include": "#component_block" }, { "include": "#inline" }], "repository": { "attribute": { "patterns": [{ "captures": { "2": { "name": "entity.other.attribute-name.html" }, "3": { "patterns": [{ "include": "#attribute-interior" }] } }, "match": `(?x)
|
||
|
(
|
||
|
([^=><\\s]*) # attribute name
|
||
|
( # attribute value
|
||
|
=["]([^"]*)(["])|[']([^']*)(['])
|
||
|
| =[^\\s'"}]*
|
||
|
)?
|
||
|
\\s*
|
||
|
)` }] }, "attribute-interior": { "patterns": [{ "begin": "=", "beginCaptures": { "0": { "name": "punctuation.separator.key-value.html" } }, "end": "(?<=[^\\s=])(?!\\s*=)|(?=/?>)", "patterns": [{ "match": "([^\\s\"'=<>`/]|/(?!>))+", "name": "string.unquoted.html" }, { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.html" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.html" } }, "name": "string.quoted.double.html", "patterns": [{ "include": "#entities" }] }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.html" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.html" } }, "name": "string.quoted.single.html", "patterns": [{ "include": "#entities" }] }, { "match": "=", "name": "invalid.illegal.unexpected-equals-sign.html" }] }] }, "attributes": { "captures": { "1": { "name": "punctuation.definition.tag.start.component" }, "3": { "patterns": [{ "include": "#attribute" }] }, "4": { "name": "punctuation.definition.tag.end.component" } }, "match": "(?x)( # attributes\n ({)\n ([^{]*)\n (})\n )", "name": "attributes.mdc" }, "block": { "patterns": [{ "include": "#component_block" }, { "include": "text.html.markdown#separator" }, { "include": "#heading" }, { "include": "#blockquote" }, { "include": "#lists" }, { "include": "text.html.markdown#fenced_code_block" }, { "include": "text.html.markdown#link-def" }, { "include": "text.html.markdown#html" }, { "include": "#paragraph" }] }, "blockquote": { "begin": "(^|\\G)[ ]*(>) ?", "captures": { "2": { "name": "punctuation.definition.quote.begin.markdown" } }, "name": "markup.quote.markdown", "patterns": [{ "include": "#block" }], "while": "(^|\\G)\\s*(>) ?" }, "component_block": { "begin": "(?x)\n (^|\\G)(\\s*)\n (:{2,}) # component colons\n (?i:\n (\\w[\\w\\d-]+) # component name\n ( # folowing spaces or attributes\n \\s*\n | \\s*({[^{]*})\n )\n $\n )", "beginCaptures": { "3": { "name": "punctuation.definition.tag.start.mdc" }, "4": { "name": "entity.name.tag.mdc" }, "5": { "patterns": [{ "include": "#attributes" }] } }, "end": "(^|\\G)(\\2)(\\3)\\s*$", "endCaptures": { "3": { "name": "punctuation.definition.tag.end.mdc" } }, "name": "block.component.mdc", "patterns": [{ "captures": { "2": { "name": "punctuation.definition.tag.end.mdc" } }, "match": "(^|\\G)\\s*([:]{2,})$" }, { "include": "#content" }] }, "component_inline": { "captures": { "2": { "name": "punctuation.definition.tag.start.component" }, "3": { "name": "entity.name.tag.component" }, "5": { "patterns": [{ "include": "#attributes" }] }, "6": { "patterns": [{ "include": "#span" }] }, "7": { "patterns": [{ "include": "#span" }] }, "8": { "patterns": [{ "include": "#attributes" }] } }, "match": "(?x)\n (^|\\G|\\s+)\n (:) # component colon\n (?i: # component name\n (\\w[\\w\\d-]*)\n )\n (\n ({[^}]*}) # attributes\n (\\[[^\\]]*\\])? # slot\n # reverse order\n | (\\[[^\\]]*\\]) # slot\n ({[^}]*})? # attributes\n )?\n \\s", "name": "inline.component.mdc" }, "content": { "begin": "(^|\\G)(\\s*)(.*)", "contentName": "meta.embedded.block.mdc", "patterns": [{ "begin": "(^|\\G)(\\s*)(-{3})(\\s*)$", "end": "(^|\\G)(\\s*(-{3})(\\s*)$)", "patterns": [{ "include": "source.yaml" }] }, { "captures": { "2": { "name": "entity.other.attribute-name.html" }, "3": { "name": "comment.block.html" } }, "match": "^(\\s*)(#[\\w\\-\\_]*)\\s*(<!--(.*)-->)?$" }, { "include": "#block" }], "while": "(^|\\G)(?!\\s*([:]{2,})\\s*$)" }, "entities": { "patterns": [{ "captures": { "1": { "name": "punctuation.definition.entity.html" }, "912": { "name": "punctuation.definition.entity.html" } }, "match": "(?x)\n (&) (?=[a-zA-Z])\n (\n (a(s(ymp(eq)?|cr|t)|n(d(slope|d|v|and)?|g(s(t|ph)|zarr|e|le|rt(vb(d)?)?|msd(a(h|c|d|e|f|a|g|b))?)?)|c(y|irc|d|ute|E)?|tilde|o(pf|gon)|uml|p(id|os|prox(eq)?|e|E|acir)?|elig|f(r)?|w(conint|int)|l(pha|e(ph|fsym))|acute|ring|grave|m
|
||
|
var mdc = [
|
||
|
...markdown,
|
||
|
...yaml,
|
||
|
lang
|
||
|
];
|
||
|
|
||
|
export { mdc as default };
|