{
"name": "Mediawiki",
"scopeName": "text.html.mediawiki",
"patterns": [
{
"include": "#block"
},
{
"include": "#inline"
}
],
"repository": {
"block": {
"patterns": [
{
"name": "meta.redirect.mediawiki",
"begin": "^\\s*(?i)(#redirect)",
"end": "\\n",
"patterns": [
{
"include": "#link"
}
],
"beginCaptures": {
"1": {
"name": "keyword.control.redirect.mediawiki"
}
}
},
{
"name": "meta.tag.source.mediawiki",
"begin": " ?(\u003c)(source)[ \\t]+(lang)(=)(\"[^\"]+\")(\u003e)",
"end": " ?(\u003c/)(source)(\u003e)",
"patterns": [
{
"include": "#tag-stuff"
}
],
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.mediawiki"
},
"2": {
"name": "storage.type.mediawiki"
},
"3": {
"name": "storage.type.mediawiki"
},
"4": {
"name": "punctuation.section.mediawiki"
},
"5": {
"name": "string.quoted.mediawiki"
},
"6": {
"name": "punctuation.definition.tag.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.mediawiki"
},
"2": {
"name": "storage.type.mediawiki"
},
"3": {
"name": "punctuation.definition.tag.mediawiki"
}
}
},
{
"name": "markup.heading.${1/=(?\u003cb\u003e=)?(?\u003cc\u003e=)?(?\u003cd\u003e=)?(?\u003ce\u003e=)?(?\u003cf\u003e=)?/${f:?6:${e:?5:${d:?4:${c:?3:${b:?2:1}}}}}/}.mediawiki",
"match": "^(={1,6})(?!=)((.+))(\\1)\\s*$\\n?",
"captures": {
"1": {
"name": "punctuation.definition.heading.mediawiki"
},
"2": {
"name": "entity.name.section.mediawiki"
},
"3": {
"patterns": [
{
"name": "invalid.illegal.extra-equals-sign.mediawiki",
"match": "=+$"
},
{
"include": "#inline"
}
]
},
"4": {
"name": "punctuation.definition.heading.mediawiki"
}
}
},
{
"name": "meta.separator.mediawiki",
"match": "^-{4,}[ \\t]*($\\n)?"
},
{
"name": "markup.raw.block.mediawiki",
"begin": "^ (?=\\s*\\S)",
"end": "^(?=[^ ])",
"patterns": [
{
"include": "#inline"
}
]
},
{
"name": "markup.list.numbered.mediawiki",
"begin": "^([#:;])",
"end": "^(?!\\1)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"name": "markup.list.unnumbered.mediawiki",
"begin": "^([*])",
"end": "^(?!\\1)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"include": "#table"
},
{
"include": "#comments"
},
{
"name": "meta.paragraph.mediawiki",
"begin": "^(?![\\t ;*#:=]|----|$)",
"end": "^(?:\\s*$|(?=[;*#:=]|----))",
"patterns": [
{
"include": "#inline"
}
]
}
]
},
"block_html": {
"patterns": [
{
"name": "meta.embedded.tex.math",
"contentName": "source.tex.math",
"begin": "(\u003cmath\u003e)",
"end": "((\u003c)/math\u003e)",
"patterns": [
{
"include": "text.tex#math"
}
],
"captures": {
"0": {
"name": "punctuation.section.embedded.tex.math"
},
"1": {
"name": "meta.tag.inline.math.mediawiki"
},
"2": {
"name": "source.tex.math"
}
}
},
{
"name": "meta.embedded.html.table",
"contentName": "source.html",
"begin": "\u003ctable[^\u003e]*\u003e",
"end": "\u003c/table\u003e",
"patterns": [
{
"include": "text.html.basic"
}
]
},
{
"name": "meta.reference.mediawiki",
"contentName": "meta.reference.content.mediawiki",
"begin": "(\u003c)(ref)(\u003e)",
"end": "(\u003c/)(ref)(\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
},
"2": {
"name": "entity.name.tag.ref.mediawiki"
},
"3": {
"name": "meta.tag.inline.ref.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
},
"2": {
"name": "entity.name.tag.ref.mediawiki"
},
"3": {
"name": "meta.tag.inline.ref.mediawiki"
}
}
},
{
"name": "meta.reference.named.cite.mediawiki",
"match": "(\u003c)(ref) *((name) *(=) *([^\u003e]*))(/\u003e)",
"captures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
},
"2": {
"name": "entity.name.tag.ref.mediawiki"
},
"4": {
"name": "entity.name.tag.name.mediawiki"
},
"5": {
"name": "meta.tag.inline.ref.mediawiki"
},
"6": {
"name": "string.quoted.ref.name.mediawiki"
},
"7": {
"name": "meta.tag.inline.ref.mediawiki"
}
}
},
{
"contentName": "meta.reference.content.labelled.mediawiki",
"begin": "(\u003c)(ref) *((name) *(=) *([^\u003e]*))(\u003e)",
"end": "(\u003c/ref\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
},
"2": {
"name": "entity.name.tag.ref.mediawiki"
},
"4": {
"name": "entity.name.tag.name.mediawiki"
},
"5": {
"name": "meta.tag.inline.ref.mediawiki"
},
"6": {
"name": "string.quoted.ref.name.mediawiki"
},
"7": {
"name": "meta.tag.inline.ref.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
}
}
},
{
"contentName": "meta.gallery.mediawiki",
"begin": "(\u003cgallery\u003e)",
"end": "(\u003c/gallery\u003e)",
"patterns": [
{
"name": "meta.item.gallery.mediawiki",
"begin": "(?x)\n\t\t\t\t\t\t\t\t^(?!\\s*\\n)\t # not an empty line\n\t\t\t\t\t\t\t\t( [ ]*(((i|I)mage)(:)) # spaces, image, colon\n\t\t\t\t\t\t\t\t ([^\\[\\]|]+) # anything\n\t\t\t\t\t\t\t\t (?\u003c!\\s)[ ]* # spaces\n\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t",
"end": "\\n",
"patterns": [
{
"contentName": "string.other.title.gallery.mediawiki",
"begin": "^(?!\\|)|(\\|)",
"end": "\\n|(?=\\|)",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
}
}
},
{
"name": "punctuation.fix_this_later.pipe.mediawiki",
"match": "\\|"
}
],
"beginCaptures": {
"3": {
"name": "constant.other.namespace.image.mediawiki"
},
"5": {
"name": "punctuation.fix_this_later.colon.mediawiki"
},
"6": {
"name": "constant.other.wiki-link.image.mediawiki"
}
}
}
],
"captures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
}
}
}
]
},
"comments": {
"patterns": [
{
"name": "comment.block.html.mediawiki",
"begin": "\u003c!--",
"end": "--\\s*\u003e",
"patterns": [
{
"name": "invalid.illegal.bad-comments-or-CDATA.html.mediawiki",
"match": "--"
}
]
}
]
},
"entities": {
"patterns": [
{
"name": "constant.character.entity.html.mediawiki",
"match": "\u0026([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);"
},
{
"name": "invalid.illegal.bad-ampersand.html.mediawiki",
"match": "\u0026"
}
]
},
"inline": {
"patterns": [
{
"match": "(~~~~~)(~{0,2})(?!~)",
"captures": {
"1": {
"name": "constant.other.date-time.mediawiki"
},
"2": {
"name": "invalid.illegal.too-many-tildes.mediawiki"
}
}
},
{
"name": "constant.other.signature.mediawiki",
"match": "~~~~?"
},
{
"include": "#link"
},
{
"include": "#style"
},
{
"include": "#table"
},
{
"include": "#template"
},
{
"include": "#block_html"
},
{
"include": "#comments"
}
]
},
"link": {
"patterns": [
{
"name": "meta.image.wiki.mediawiki",
"begin": "(?x:\n\t\t\t\t\t\t(\\[\\[) # opening brackets\n\t\t\t\t\t\t ( [ ]*(((i|I)mage)(:)) # spaces, image, colon\n\t\t\t\t\t\t ([^\\[\\]|]+) # anything\n\t\t\t\t\t\t (?\u003c!\\s)[ ]* # spaces\n\t\t\t\t\t\t )\n\t\t\t\t\t)",
"end": "(?x:\n\t\t\t\t\t\t ((\\|)[ ]*( [^\\[\\]|]+ )[ ]*)? # pipe, spaces, anything, spaces\n\t\t\t\t\t\t(\\]\\]) # closing brackets\n\t\t\t\t\t)",
"patterns": [
{
"match": "(?x)\n\t\t\t\t\t\t\t\t(\\|)[ ]*\n\t\t\t\t\t\t\t\t( (thumb|thumbnail|frame)\n\t\t\t\t\t\t\t\t |(right|left|center|none)\n\t\t\t\t\t\t\t\t |([0-9]+)(px)\n\t\t\t\t\t\t\t\t)[ ]*\n\t\t\t\t\t\t\t",
"captures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"2": {
"name": "keyword.control.image.formatting.mediawiki"
},
"3": {
"name": "keyword.control.image.alignment.mediawiki"
},
"4": {
"name": "constant.numeric.image.width.mediawiki"
},
"5": {
"name": "constant.other.unit.mediawiki"
}
}
},
{
"name": "punctuation.fix_this_later.pipe.mediawiki",
"match": "\\|"
},
{
"include": "#style_in_link"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.any.mediawiki"
},
"4": {
"name": "constant.other.namespace.image.mediawiki"
},
"6": {
"name": "punctuation.fix_this_later.colon.mediawiki"
},
"7": {
"name": "constant.other.wiki-link.image.mediawiki"
}
},
"endCaptures": {
"2": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"3": {
"name": "string.other.title.link.wiki-link.mediawiki"
}
},
"applyEndPatternLast": true
},
{
"name": "meta.link.wiki.redirect.mediawiki",
"begin": "(?x:\n\t\t\t\t\t({{) # opening brackets\n\t\t\t\t\t\t([Rr]edirect|subst:.*) # redirect?\n\t\t\t\t\t\t[ ]* # spaces\n\t\t\t\t\t\t(\\|) # pipe\n\t\t\t\t\t)",
"end": "(?x:\n\t\t\t\t\t\t\t(([\\|}]+)(\\|)([\\|}]+))? # from | to \n\t\t\t\t\t\t\t([^}]*) # anything\n\t\t\t\t\t\t\t(}}) # closing brackets\n\t\t\t\t\t)",
"patterns": [
{
"include": "#style_in_link"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.redirect.mediawiki"
},
"2": {
"name": "keyword.operator.wiki-link.redirect.mediawiki"
},
"3": {
"name": "constant.other.pipe.mediawiki"
}
},
"endCaptures": {
"2": {
"name": "meta.tag.inline.any.mediawiki"
},
"3": {
"name": "markup.underline.link.internal.mediawiki"
},
"4": {
"name": "constant.other.pipe.mediawiki"
},
"6": {
"name": "meta.tag.inline.redirect.mediawiki"
}
}
},
{
"name": "meta.link.wiki.mediawiki",
"begin": "(?x:\n\t\t\t\t\t\t(\\[\\[) # opening brackets\n\t\t\t\t\t\t (:)? # colon to suppress image or category?\n\t\t\t\t\t\t ((\\s+):[^\\[\\]]*(?=\\]\\]))? # a colon after spaces is invalid\n\t\t\t\t\t\t [ ]* # spaces\n\t\t\t\t\t\t ( (([^\\[\\]|]+)(:))? # namespace\n\t\t\t\t\t\t ([^\\[\\]|]+)(?\u003c!\\s)[ ]* # link name\n\t\t\t\t\t\t )?\n\t\t\t\t\t)",
"end": "(?x:\n\t\t\t\t\t\t (\\|[ ]*([^\\[\\]\\|]+)[ ]*)? # pipe, spaces, anything, spaces\n\t\t\t\t\t\t(\\]\\]) # closing brackets\n\t\t\t\t\t)",
"patterns": [
{
"include": "#style_in_link"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.any.mediawiki"
},
"2": {
"name": "keyword.operator.wiki-link.suppress-image-or-category.mediawiki"
},
"4": {
"name": "invalid.illegal.whitespace.mediawiki"
},
"7": {
"name": "constant.other.namespace.mediawiki"
},
"8": {
"name": "punctuation.fix_this_later.colon.mediawiki"
},
"9": {
"name": "constant.other.wiki-link.mediawiki"
}
},
"endCaptures": {
"2": {
"name": "string.other.title.link.wiki-link.mediawiki"
},
"3": {
"name": "meta.tag.inline.any.mediawiki"
}
}
},
{
"name": "meta.link.inline.external.mediawiki",
"contentName": "string.other.title.link.external.mediawiki",
"begin": "\\[(\\S+)\\s*(?=[^\\]]*\\])",
"end": "\\]",
"patterns": [
{
"include": "#style_in_link"
}
],
"beginCaptures": {
"1": {
"name": "markup.underline.link.external.mediawiki"
}
}
},
{
"name": "markup.underline.link.external.mediawiki",
"match": "((https?|ftp|file)://|mailto:)[-:@a-zA-Z0-9_.~%+/?=\u0026#]+(?\u003c![.?:])"
}
]
},
"style": {
"patterns": [
{
"name": "markup.bold.mediawiki",
"begin": "'''",
"end": "'''",
"patterns": [
{
"include": "#inline"
}
]
},
{
"name": "markup.italic.mediawiki",
"begin": "''",
"end": "''(?!'[^'])",
"patterns": [
{
"include": "#inline"
}
]
},
{
"contentName": "markup.bold.html.mediawiki",
"begin": "(\u003c(b|strong)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.bold.html.mediawiki"
}
}
},
{
"contentName": "markup.italic.html.mediawiki",
"begin": "(\u003c(i|em)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.italic.html.mediawiki"
}
}
},
{
"contentName": "markup.other.strikethrough.html.mediawiki",
"begin": "(\u003c(s|strike)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.strikethrough.html.mediawiki"
}
}
},
{
"contentName": "markup.underline.html.mediawiki",
"begin": "(\u003c(u)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.underline.html.mediawiki"
}
}
},
{
"contentName": "markup.raw.html.mediawiki",
"begin": "(\u003c(tt|code)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.raw.html.mediawiki"
}
}
},
{
"contentName": "markup.other.inline-styles.html.mediawiki",
"begin": "(\u003c(big|small|sub|sup)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#inline"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.any.html.mediawiki"
}
}
}
]
},
"style_in_link": {
"patterns": [
{
"name": "markup.bold.mediawiki",
"begin": "'''",
"end": "'''",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"name": "markup.italic.mediawiki",
"begin": "''",
"end": "''",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"contentName": "markup.bold.html.mediawiki",
"begin": "(\u003c(b|strong)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.bold.html.mediawiki"
}
}
},
{
"contentName": "markup.italic.html.mediawiki",
"begin": "(\u003c(i|em)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.italic.html.mediawiki"
}
}
},
{
"contentName": "markup.other.strikethrough.html.mediawiki",
"begin": "(\u003c(s|strike)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.strikethrough.html.mediawiki"
}
}
},
{
"contentName": "markup.underline.html.mediawiki",
"begin": "(\u003c(u)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.underline.html.mediawiki"
}
}
},
{
"contentName": "markup.raw.html.mediawiki",
"begin": "(\u003c(tt|code)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.raw.html.mediawiki"
}
}
},
{
"contentName": "markup.other.inline-styles.html.mediawiki",
"begin": "(\u003c(big|small|sub|sup)\u003e)",
"end": "(\u003c/\\2\u003e)",
"patterns": [
{
"include": "#style_in_link"
}
],
"captures": {
"1": {
"name": "meta.tag.inline.any.html.mediawiki"
}
}
},
{
"include": "#comments"
}
]
},
"table": {
"patterns": [
{
"name": "markup.other.table.mediawiki",
"begin": "^({\\|)",
"end": "(^\\|})",
"patterns": [
{
"name": "meta.table.caption.mediawiki",
"match": "^(\\|\\+)[\\t ]*(.*)$",
"captures": {
"1": {
"name": "meta.tag.inline.table.caption.mediawiki"
},
"2": {
"name": "variable.parameter.name.string.mediawiki"
}
}
},
{
"name": "markup.other.table.row.mediawiki",
"begin": "^\\|-",
"end": "^(?=\\|-|^\\|})",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.table.mediawiki"
}
}
},
{
"name": "meta.table.cell.mediawiki",
"match": "(^\\||\\|\\|) *([^\\|]*) *",
"captures": {
"1": {
"name": "meta.tag.inline.table.cellwall.mediawiki"
},
"2": {
"name": "string.other.table.cellcontents.mediawiki"
}
}
},
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.table.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "meta.tag.inline.table.mediawiki"
}
}
}
]
},
"template": {
"patterns": [
{
"name": "meta.template-parameter.mediawiki",
"match": "{{{[ ]*([0-9]+)[ ]*}}}",
"captures": {
"1": {
"name": "variable.parameter.template.numeric.mediawiki"
}
}
},
{
"name": "meta.template-parameter.mediawiki",
"match": "{{{[ ]*(.*?)[ ]*}}}",
"captures": {
"1": {
"name": "variable.parameter.template.named.mediawiki"
}
}
},
{
"name": "meta.template.parser-function.mediawiki",
"begin": "({{)(?=[ ]*#)",
"end": "(}})",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.template.mediawiki"
},
"2": {
"name": "meta.function-call.template.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "meta.tag.inline.template.mediawiki"
}
}
},
{
"name": "meta.template.mediawiki",
"begin": "({{)([^{}\\|]+)?",
"end": "(}})",
"patterns": [
{
"include": "#comments"
},
{
"contentName": "comment.block.template-hack.mediawiki",
"begin": "(\\|)\\s*(=)",
"end": "(?=[|}])",
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"2": {
"name": "punctuation.fix_this_later.equals-sign.mediawiki"
}
}
},
{
"contentName": "meta.value.template.mediawiki",
"begin": "(\\|)(([^{}\\|=]+)(=))?",
"end": "(?=[|}])",
"patterns": [
{
"include": "#inline"
}
],
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"2": {
"name": "variable.parameter.template.mediawiki"
},
"3": {
"name": "punctuation.fix_this_later.equals-sign.mediawiki"
}
}
},
{
"name": "punctuation.fix_this_later.pipe.mediawiki",
"match": "\\|"
}
],
"beginCaptures": {
"1": {
"name": "meta.tag.inline.template.mediawiki"
},
"2": {
"name": "meta.function-call.template.mediawiki"
}
},
"endCaptures": {
"1": {
"name": "meta.tag.inline.template.mediawiki"
}
}
}
]
}
}
}