@wooorm/starry-night
Version:
Syntax highlighting, like GitHub
1,243 lines (1,241 loc) • 91.1 kB
JavaScript
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Lukasa/language-restructuredtext>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.rst', '.rest', '.rest.txt', '.rst.txt'],
injections: {
'L:meta.numref.restructuredtext': {
patterns: [
{
captures: {
1: {name: 'punctuation.definition.placeholder.restructuredtext'}
},
match: '(%)s',
name: 'constant.other.placeholder.figure-number.restructuredtext'
},
{
captures: {
1: {
name: 'punctuation.definition.placeholder.begin.restructuredtext'
},
3: {name: 'punctuation.definition.placeholder.end.restructuredtext'}
},
match: '({)(name|number)(})',
name: 'constant.other.placeholder.figure-$2.restructuredtext'
}
]
}
},
names: ['restructuredtext', 'rst'],
patterns: [{include: '#all'}],
repository: {
all: {
patterns: [
{include: '#escape'},
{include: '#line-block'},
{include: '#tables'},
{include: '#headings'},
{include: '#substitution-definition'},
{include: '#citation-definition'},
{include: '#footnote-definition'},
{include: '#directives'},
{include: '#raw-blocks'},
{include: '#link-target'},
{include: '#inlines'},
{include: '#tag-name'},
{include: '#doctest'},
{include: '#domains'},
{include: '#comments'}
]
},
citation: {
captures: {
1: {name: 'punctuation.definition.citation.begin.restructuredtext'},
2: {name: 'constant.other.reference.link.restructuredtext'},
3: {name: 'punctuation.definition.citation.end.restructuredtext'},
4: {name: 'punctuation.definition.reference.restructuredtext'}
},
match:
'(?x) (?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])) (\\[)((?=[A-Za-z])(?:[-_.:+]?[A-Za-z0-9])++)(\\])(_) (?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])',
name: 'meta.citation.reference.restructuredtext'
},
'citation-definition': {
begin:
'(?:^(\\s*)|(?!^)\\G\\s*)(\\.\\.)\\s+(\\[)((?=[A-Za-z])(?:[-_.:+]?[A-Za-z0-9])++)(\\])(?:$|\\s+)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'punctuation.definition.citation.begin.restructuredtext'},
4: {name: 'entity.name.citation.restructuredtext'},
5: {name: 'punctuation.definition.citation.end.restructuredtext'}
},
contentName: 'string.unquoted.citation.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
name: 'meta.citation.definition.restructuredtext',
patterns: [{include: '#all'}]
},
comments: {
patterns: [
{
begin: '^([ \\t]+)(\\.\\.)\\s+(?=\\S)(?!\\[[^\\]]+\\](?:$|\\s))',
beginCaptures: {
2: {name: 'punctuation.definition.comment.restructuredtext'}
},
end: '(?!\\G)^(?:(?=\\S)|(?!\\1[ \\t]+\\S|\\s*$))',
name: 'comment.block.double-dot.indented.has-text.restructuredtext'
},
{
begin: '^([ \\t]+)(\\.\\.)[ \\t]*$',
beginCaptures: {
2: {name: 'punctuation.definition.comment.restructuredtext'}
},
end: '(?!\\G)^(?:(?=\\S)|(?!\\1[ \\t]+\\S))',
name: 'comment.block.double-dot.indented.no-text.restructuredtext',
patterns: [
{
applyEndPatternLast: true,
begin: '(?<!\\G)(?<=\\S)$',
end: '^',
patterns: [{match: '^[ \\t]*$'}]
}
]
},
{
begin: '^(\\.\\.)\\s+(?=\\S)(?!\\[[^\\]]+\\](?:$|\\s))',
beginCaptures: {
1: {name: 'punctuation.definition.comment.restructuredtext'}
},
end: '(?!\\G)^(?=\\S)',
name: 'comment.block.double-dot.unindented.has-text.restructuredtext'
},
{
begin: '^(\\.\\.)[ \\t]*$',
beginCaptures: {
1: {name: 'punctuation.definition.comment.restructuredtext'}
},
end: '(?!\\G)^(?=\\S|\\s*$)',
name: 'comment.block.double-dot.unindented.no-text.restructuredtext',
patterns: [
{
applyEndPatternLast: true,
begin: '(?<!\\G)(?<=\\S)$',
end: '^',
patterns: [{match: '^[ \\t]*$'}]
}
]
}
]
},
'directive-options': {
patterns: [
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'string.other.tag-value.restructuredtext'}
},
match: '(:[^:]+:)\\s*(.*)',
name: 'meta.directive-option.restructuredtext'
}
]
},
directives: {
patterns: [
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(image)(::)\\s*(\\S+)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'constant.other.reference.link.restructuredtext'}
},
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
name: 'meta.image.restructuredtext',
patterns: [{include: '#image-options'}]
},
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(figure)(::)\\s*(\\S+)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'constant.other.reference.link.restructuredtext'}
},
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
name: 'meta.figure.restructuredtext',
patterns: [{include: '#image-options'}, {include: '#all'}]
},
{include: '#toctree'},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(raw|code(?:-block)?)(::)\\s+(html)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'text.html.basic'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(coffee-?script)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.coffee',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.coffee'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(js|javascript)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.js',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.js'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(typescript)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.ts',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.ts'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(json)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.json',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.json'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(css)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.css',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.css'}]
},
{
begin:
'^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+((?:pseudo)?xml)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.xml',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'text.xml'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(ruby)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.ruby',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.ruby'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(java)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.java',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.java'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(erlang)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.erlang',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.erlang'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(csharp|c#)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.cs',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.cs'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(php[3-5]?)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.php',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'text.html.php'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(shell|(ba|k)?sh)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.shell',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.shell'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(py(thon)?|sage)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.python',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.python'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(ipython)(::)\\s+(py(thon)?)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.python',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.python'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(stata)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.stata',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.stata'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(sas)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.python',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.python'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(objective-?c|obj-?c)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.objc',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.objc'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(yaml)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.yaml',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.yaml'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?)(::)\\s+(cfg|dosini|ini)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.ini',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [
{
captures: {1: {patterns: [{include: 'source.ini'}]}},
match: '(?:^|\\G)[ \\t]*(\\S.*)'
}
]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(manpage|man|[ntg]?roff)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'text.embedded.roff',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [
{
captures: {1: {patterns: [{include: 'text.roff'}]}},
match: '(?:^|\\G)[ \\t]*(\\S.*)'
}
]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+([dg]?pic|pikchr|pic2plot|dformat)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.pic',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.pic'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(ditroff|groff[-_]?out|grout)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.ditroff',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.ditroff'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+((?:xe)?(?:la)?tex)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'text.embedded.tex.latex',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'text.tex.latex'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(texinfo)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'text.embedded.texinfo',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'text.texinfo'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(postscript|ps|eps)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.postscript',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.postscript#main'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(posh|powershell|ps1|psm1|pwsh)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.powershell',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.powershell'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+((?:dos|win)?batch|bat)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.batchfile',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.batchfile'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(swift)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.swift',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.swift'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)\\s+(applescript)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'source.embedded.applescript',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: 'source.applescript'}]
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(code(?:-block)?|raw)(::)(?:\\s+([-\\w]+))?(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'markup.raw.inner.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]+\\S)'
},
{
begin:
'(?i)^([ \\t]*)(\\.\\.)\\s+(parsed-literal)(::)(?:\\s+([-\\w]+))?(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'entity.name.directive.restructuredtext'}
},
contentName: 'markup.raw.inner.parsed.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
patterns: [{include: '#inlines'}]
},
{
begin: '(?i)^([ \\t]*)(\\.\\.)\\s+(math)(::)(?=\\s*$)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'}
},
contentName: 'markup.math.block.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
name: 'source.embedded.latex',
patterns: [{include: 'text.tex#math'}]
},
{
captures: {
1: {name: 'punctuation.definition.directive.restructuredtext'},
2: {name: 'support.directive.restructuredtext'},
3: {name: 'punctuation.separator.key-value.restructuredtext'},
4: {
patterns: [
{
match: '<|>',
name: 'punctuation.definition.bracket.angle.restructuredtext'
},
{
match: ',',
name: 'punctuation.delimiter.comma.restructuredtext'
},
{
match: '[^\\s<>,]+',
name: 'entity.name.directive.restructuredtext'
}
]
}
},
match: '(?i)^\\s*(\\.\\.)\\s+(option)(::)\\s*(.+)?$',
name: 'meta.option.directive.restructuredtext'
},
{
captures: {
1: {name: 'punctuation.definition.directive.restructuredtext'},
2: {name: 'support.directive.restructuredtext'},
3: {name: 'punctuation.separator.key-value.restructuredtext'}
},
match: '^\\s*(\\.\\.)\\s+([A-z][-A-z0-9_]+)(::)(?=\\s*$)',
name: 'meta.other.directive.restructuredtext'
},
{
captures: {
1: {name: 'punctuation.definition.directive.restructuredtext'},
2: {name: 'support.directive.restructuredtext'},
3: {name: 'punctuation.separator.key-value.restructuredtext'},
4: {name: 'entity.name.directive.restructuredtext'}
},
match: '^\\s*(\\.\\.)\\s+([A-z][-A-z0-9_]+)(::)\\s+(.+?)(?=\\s*$)',
name: 'meta.other.directive.restructuredtext'
}
]
},
doctest: {
patterns: [
{
begin: '^(?=(\\s+)>>>(?:\\s+\\S.*)?[ \\t]*$)',
end: '^(?=\\s*$)|^(?=(?:(?!\\1)\\s+)?\\S)',
name: 'meta.doctest.indented.restructuredtext',
patterns: [
{
begin: '^(\\s+)(>>>)\\s+(\\S.*)?(?=[ \\t]*$)',
beginCaptures: {
2: {
name: 'punctuation.separator.prompt.primary.doctest.restructuredtext'
},
3: {
name: 'source.embedded.python',
patterns: [{include: 'source.python'}]
}
},
end: '(?=^\\s*$)|^(?!\\1((?!(?:>>>|\\.{3})\\s+)\\s*\\S.*[ \\t]*)$)',
endCaptures: {
1: {name: 'markup.raw.output.doctest.restructuredtext'}
},
patterns: [
{
captures: {
1: {name: 'markup.raw.output.doctest.restructuredtext'}
},
match: '^\\s+(?!(?:>>>|\\.{3})\\s+)(\\S.*)(?=[ \\t]*$)'
}
]
},
{
begin: '^(\\s+)(\\.{3})\\s+(\\S.*)?(?=[ \\t]*$)',
beginCaptures: {
2: {
name: 'punctuation.separator.prompt.secondary.doctest.restructuredtext'
},
3: {
name: 'source.embedded.python',
patterns: [{include: 'source.python'}]
}
},
end: '(?=^\\s*$)|^(?!\\1((?!(?:>>>|\\.{3})\\s+)\\s*\\S.*[ \\t]*)$)',
endCaptures: {
1: {name: 'markup.raw.output.doctest.restructuredtext'}
},
patterns: [
{
captures: {
1: {name: 'markup.raw.output.doctest.restructuredtext'}
},
match: '^\\s+(?!(?:>>>|\\.{3})\\s+)(\\S.*)(?=[ \\t]*$)'
}
]
},
{
match: '^(?!(?:>>>|\\.{3})\\s+)(\\s*\\S.*[ \\t]*)$',
name: 'markup.raw.output.doctest.restructuredtext'
}
]
},
{
begin: '^(?=>>>(?:\\s+\\S.*)?[ \\t]*$)',
end: '^(?=\\s*$)',
name: 'meta.doctest.unindented.restructuredtext',
patterns: [
{
captures: {
1: {
name: 'punctuation.separator.prompt.primary.doctest.restructuredtext'
},
2: {
name: 'source.embedded.python',
patterns: [{include: 'source.python'}]
}
},
match: '^(>>>)\\s+(\\S.*)?(?=[ \\t]*$)'
},
{
captures: {
1: {
name: 'punctuation.separator.prompt.secondary.doctest.restructuredtext'
},
2: {
name: 'source.embedded.python',
patterns: [{include: 'source.python'}]
}
},
match: '^(\\.{3})\\s+(\\S.*)?(?=[ \\t]*$)'
},
{
match: '^(?!(?:>>>|\\.{3})\\s+)(\\s*\\S.*[ \\t]*)$',
name: 'markup.raw.output.doctest.restructuredtext'
}
]
}
]
},
'doctree-options': {
patterns: [
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'string.other.class-list.restructuredtext'}
},
match: '(?i)(:class:)\\s*(.*)',
name: 'meta.doctree-option.class.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'string.other.name.restructuredtext'}
},
match: '(?i)(:name:)\\s*(.*)',
name: 'meta.doctree-option.name.restructuredtext'
}
]
},
domains: {
patterns: [
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(py)(:)([^:]+)(::)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'support.directive.restructuredtext'},
6: {name: 'punctuation.separator.key-value.restructuredtext'}
},
contentName: 'source.embedded.python',
end: '^(?!\\s*$|\\1[ \\t]{6,}\\S)',
name: 'meta.sphinx-domain.restructuredtext',
patterns: [
{
captures: {
1: {patterns: [{include: 'source.python'}]},
2: {name: 'punctuation.parenthesis.begin.python'},
3: {
patterns: [
{
match: '\\\\.',
name: 'constant.character.escape.restructuredtext'
},
{include: 'source.python'}
]
},
4: {name: 'punctuation.parenthesis.end.python'}
},
match: '(?:\\G|^)([^(]*)(\\()([^\\\\)]*\\\\[^)]*)(\\))'
},
{include: 'source.python'}
]
},
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(c)(:)([^:]+)(::)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'support.directive.restructuredtext'},
6: {name: 'punctuation.separator.key-value.restructuredtext'}
},
contentName: 'source.embedded.c',
end: '^(?!\\s*$|\\1[ \\t]{5,}\\S)',
name: 'meta.sphinx-domain.restructuredtext',
patterns: [{include: 'source.c'}]
},
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(cpp)(::?)([^:]+)(::)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'support.directive.restructuredtext'},
6: {name: 'punctuation.separator.key-value.restructuredtext'}
},
end: '^(?!\\s*$|\\1[ \\t]{5,}\\S)',
name: 'meta.sphinx-domain.restructuredtext',
patterns: [
{
captures: {
1: {
name: 'source.embedded.cpp',
patterns: [{include: 'source.c++'}]
},
2: {name: 'constant.character.escape.newline.restructuredtext'}
},
match: '(.+)(\\\\?)$'
}
]
},
{
begin: '(?i)^(\\s*)(\\.\\.)\\s+(js)(:)([^:]+)(::)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'support.directive.restructuredtext'},
6: {name: 'punctuation.separator.key-value.restructuredtext'}
},
end: '^(?!\\s*$|\\1[ \\t]{5,}\\S)',
name: 'meta.sphinx-domain.restructuredtext',
patterns: [
{
captures: {
1: {
name: 'source.embedded.js',
patterns: [{include: 'source.js'}]
},
2: {name: 'constant.character.escape.newline.restructuredtext'}
},
match: '(.+)(\\\\?)$'
}
]
},
{
begin: '^(\\s*)(\\.\\.)\\s+([^:]+)(::?)([^:]+)(::)',
beginCaptures: {
2: {name: 'punctuation.definition.directive.restructuredtext'},
3: {name: 'support.directive.restructuredtext'},
4: {name: 'punctuation.separator.key-value.restructuredtext'},
5: {name: 'support.directive.restructuredtext'},
6: {name: 'punctuation.separator.key-value.restructuredtext'}
},
contentName: 'string.unquoted.domain.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]{5,}\\S)',
name: 'meta.sphinx-domain.restructuredtext'
}
]
},
emphasis: {
patterns: [
{
begin:
'(?x)\n(?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}]))\n\\*\\*\n(?=\\S)\n(?!\\*\\*(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}]))',
beginCaptures: {
0: {name: 'punctuation.definition.bold.begin.restructuredtext'}
},
contentName: 'markup.bold.emphasis.strong.restructuredtext',
end: '(?<=\\S)\\*\\*(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])|^(?=\\s*$)',
endCaptures: {
0: {name: 'punctuation.definition.bold.end.restructuredtext'}
},
patterns: [{include: '#escape'}]
},
{
begin:
'(?x)\n(?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}]))\n\\*\n(?=\\S)\n(?!\\*(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}]))',
beginCaptures: {
0: {name: 'punctuation.definition.italic.begin.restructuredtext'}
},
contentName: 'markup.italic.emphasis.restructuredtext',
end: '(?<=\\S)\\*(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])|^(?=\\s*$)',
endCaptures: {
0: {name: 'punctuation.definition.italic.end.restructuredtext'}
},
patterns: [{include: '#escape'}]
}
]
},
escape: {
match: '\\\\.',
name: 'constant.character.escape.backslash.restructuredtext'
},
footnote: {
captures: {
1: {
name: 'meta.footnote.reference.numbered.manual.restructuredtext',
patterns: [{include: '#footnote-name'}]
},
2: {
name: 'meta.footnote.reference.numbered.auto.restructuredtext',
patterns: [{include: '#footnote-name'}]
},
3: {
name: 'meta.footnote.reference.symbolic.auto.restructuredtext',
patterns: [{include: '#footnote-name'}]
}
},
match:
'(?x)\n(?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}]))\n(?:\n\t# Manually-numbered: “[0]_”\n\t(\\[[0-9]+\\]_)\n\t|\n\t# Auto-numbered: “[#]_” or “[#foo]_”\n\t(\\[\\#(?:(?=\\w)(?!_)(?:[-_.:+]?[A-Za-z0-9])++)?\\]_)\n\t|\n\t# Auto-symbol: “[*]_”\n\t(\\[\\*\\]_)\n)\n(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])'
},
'footnote-definition': {
begin: '^(\\s*)(\\.\\.)\\s+(\\[[^\\]]+\\])(?:$|\\s+)',
beginCaptures: {
2: {name: 'punctuation.definition.link.restructuredtext'},
3: {patterns: [{include: '#footnote-name'}]}
},
contentName: 'string.unquoted.footnote.restructuredtext',
end: '^(?!\\s*$|\\1[ \\t]+\\S)',
name: 'meta.footnote.definition.restructuredtext',
patterns: [{include: '#all'}]
},
'footnote-name': {
begin: '(?:\\G|^)\\[',
beginCaptures: {
0: {name: 'punctuation.definition.footnote.begin.restructuredtext'}
},
contentName: 'constant.other.reference.link.restructuredtext',
end: '(\\])(_)?',
endCaptures: {
1: {name: 'punctuation.definition.footnote.end.restructuredtext'},
2: {name: 'punctuation.definition.reference.restructuredtext'}
},
name: 'meta.footnote-name.restructuredtext'
},
headings: {
captures: {1: {name: 'punctuation.definition.heading.restructuredtext'}},
match: '^(([-=~`#"^+*:.\'_])\\2{2,})(?=\\s*$)',
name: 'markup.heading.restructuredtext'
},
'image-options': {
patterns: [
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'string.other.tag-value.restructuredtext'}
},
match: '(?i)(:alt:)\\s*(.*)',
name: 'meta.image-option.alt.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {patterns: [{include: '#length'}]}
},
match: '(?i)(:height:)\\s*(.*)',
name: 'meta.image-option.height.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {patterns: [{include: '#length'}]}
},
match: '(?i)(:width:)\\s*(.*)',
name: 'meta.image-option.width.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {patterns: [{include: '#length'}]}
},
match: '(?i)(:scale:)\\s*(.*)',
name: 'meta.image-option.scale.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'keyword.language.image-alignment.restructuredtext'}
},
match:
'(?i)(:align:)\\s*(?:(top|middle|bottom|left|center|right)\\b)?',
name: 'meta.image-option.align.restructuredtext'
},
{
captures: {
1: {patterns: [{include: '#tag-name'}]},
2: {name: 'string.other.target.restructuredtext'}
},
match: '(?i)(:target:)\\s*(.*)?',
name: 'meta.image-option.target.restructuredtext'
},
{include: '#doctree-options'},
{include: '#directive-options'}
]
},
inlines: {
patterns: [
{include: '#escape'},
{include: '#quoted'},
{include: '#emphasis'},
{include: '#link-target-inline'},
{include: '#interpreted-text'},
{include: '#substitution-reference'},
{include: '#literal'},
{include: '#link-reference'},
{include: '#footnote'},
{include: '#citation'}
]
},
'interpreted-text': {
patterns: [
{include: '#interpreted-text-marked'},
{include: '#interpreted-text-unmarked'}
]
},
'interpreted-text-marked': {
begin:
'(?x) (?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])) ((:)\\w+(?:[-_.:+]\\w+)*+(:)) (?=`(?=\\S)(?!`(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])))',
beginCaptures: {
1: {name: 'keyword.operator.role.restructuredtext'},
2: {name: 'punctuation.definition.role.name.begin.restructuredtext'},
3: {name: 'punctuation.definition.role.name.end.restructuredtext'}
},
end: '(?!\\G)',
name: 'meta.interpreted-text.marked.leading-marker.restructuredtext',
patterns: [
{
begin: '\\G`',
beginCaptures: {
0: {
name: 'punctuation.definition.interpreted-text.begin.restructuredtext'
}
},
end: '(?=^\\s*$)|`(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])',
endCaptures: {
0: {
name: 'punctuation.definition.interpreted-text.end.restructuredtext'
}
},
patterns: [{include: '#roles'}]
}
]
},
'interpreted-text-unmarked': {
captures: {
1: {
name: 'punctuation.definition.interpreted-text.begin.restructuredtext'
},
2: {
name: 'string.interpolated.restructuredtext',
patterns: [{include: '#escapes'}]
},
3: {
name: 'punctuation.definition.interpreted-text.end.restructuredtext'
}
},
match:
'(?x) (?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])) (`)((?!`|\\s)(?:[^`\\\\]|\\\\.)++)(`) (?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])',
name: 'meta.interpreted-text.unmarked.restructuredtext'
},
length: {
captures: {
1: {name: 'keyword.other.${1:/downcase}-unit.restructuredtext'},
2: {name: 'keyword.other.percentile-unit.restructuredtext'}
},
match: '[\\d.]+\\s*(?i:(em|ex|px|in|cm|mm|pt|pc)|(%))?',
name: 'constant.numeric.length.restructuredtext'
},
'line-block': {
patterns: [
{
begin: '(?:\\G|^)(\\s+)(\\|)(?:(\\s+)(?=\\S)|(?=\\s*$))',
beginCaptures: {
2: {patterns: [{include: '#line-block-border'}]},
3: {
name: 'punctuation.whitespace.leading.line-indent.restructuredtext'
}
},
contentName: 'markup.quote.preserved-whitespace.restructuredtext',
end: '^(?=\\1\\|(?:\\s+(?=\\S)|(?=\\s*$))|\\s*$|(?:(?!\\1)\\s+)?\\S|\\1(?:[^|\\s]|\\|\\S))',
name: 'meta.line-block.indented.restructuredtext'
},
{
begin: '(?:\\G|^)(\\|)(?:(\\s+)(?=\\S)|(?=\\s*$))',
beginCaptures: {
1: {patterns: [{include: '#line-block-border'}]},
2: {
name: 'punctuation.whitespace.leading.line-indent.restructuredtext'
}
},
contentName: 'markup.quote.preserved-whitespace.restructuredtext',
end: '^(?=\\|(?:\\s+(?=\\S)|(?=\\s*$))|\\s*$|[^|\\s]|\\|\\S)',
name: 'meta.line-block.unindented.restructuredtext'
}
]
},
'line-block-border': {
captures: {0: {name: 'sublimelinter.gutter-mark.restructuredtext'}},
match: '\\|',
name: 'punctuation.definition.quote.line-block.restructuredtext'
},
link: {
patterns: [
{
captures: {
1: {
patterns: [
{
begin: '(?:^|\\G)',
end: '$',
name: 'entity.name.reference.restructuredtext',
patterns: [{include: '#escape'}]
}
]
},
2: {name: 'meta.link-destination.restructuredtext'},
3: {
name: 'punctuation.definition.angle.bracket.begin.restructuredtext'
},
4: {
name: 'constant.other.reference.link.restructuredtext',
patterns: [{include: '#escape'}]
},
5: {
name: 'punctuation.definition.reference.named.restructuredtext'
},
6: {
name: 'punctuation.definition.angle.bracket.end.restructuredtext'
}
},
match:
'\\G\\s*((?:[^`\\\\]|\\\\.)+\\s+)?((<)((?:[^`\\\\<>_]|_(?!>)|\\\\.)+)(_)?(>))\\s*(?=`|$)'
},
{
captures: {
1: {
patterns: [
{
begin: '(?:^|\\G)',
contentName: 'constant.other.reference.link.restructuredtext',
end: '$',
name: 'meta.link-destination.restructuredtext',
patterns: [{include: '#escape'}]
}
]
}
},
match: '\\G\\s*((?:[^`\\\\]|\\.)++)\\s*(?=`|$)'
}
]
},
'link-reference': {
patterns: [
{
captures: {
1: {patterns: [{include: '#link-reference-quoted'}]},
2: {patterns: [{include: '#link-reference-unquoted'}]}
},
match:
'(?x) (?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])) (?:(`(?:[^\\\\`]|\\\\.)*+`__?)|\\b((?=\\w)(?!_)(?:[-_.:+]?[A-Za-z0-9])++__?)) (?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])'
},
{
begin:
'(?x) (?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])) (?=`(?:[^\\\\`]|\\\\.)++$)',
end: '(?!\\G)',
patterns: [{include: '#link-reference-quoted'}]
}
]
},
'link-reference-quoted': {
begin: '(?:\\G|^)`',
beginCaptures: {
0: {name: 'punctuation.definition.link.begin.restructuredtext'}
},
end: '(`)(?:(__)\\b|(_)\\b)?',
endCaptures: {
1: {name: 'punctuation.definition.link.end.restructuredtext'},
2: {
name: 'punctuation.definition.reference.anonymous.restructuredtext'
},
3: {name: 'punctuation.definition.reference.named.restructuredtext'}
},
name: 'meta.link-reference.quoted.restructuredtext',
patterns: [
{
begin: '\\G(?=.*(?:\\G|(?<=\\s))<(?:[^\\\\<>`]|\\\\.)++>\\s*(?:$|`))',
end: '(?=\\s*(?:$|`))',
name: 'meta.embedded-target.restructuredtext',
patterns: [{include: '#link'}]
},
{
captures: {
1: {
name: 'constant.other.reference.link.restructuredtext',
patterns: [{include: '#escape'}]
}
},
match: '(?:\\G|^\\s*)((?!\\s)(?:[^\\\\`]|\\\\.)++)'
}
]
},
'link-reference-unquoted': {
begin:
'(?:\\G|(?:^|(?<=[-:/\'"<(\\[{\\s«»༺⟬⟮⸠⸡⸢⸤⸦⸨‚„‟‛])|(?<![\\x00-\\x9F])(?<=[\\p{Ps}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])))(?=\\w)(?!_)',
contentName: 'constant.other.reference.link.restructuredtext',
end: '(?:(__)|(_))(?=$|[-.,:;!?\\\\/\'")\\]}>\\s«»༻⟭⟯⸡⸠⸣⸥⸧⸩‚„‟‛]|(?![\\x00-\\x9F])[\\p{Pe}\\p{Pi}\\p{Pf}\\p{Pd}\\p{Po}])|(?=_\\W)',
endCaptures: {
1: {
name: 'punctuation.definition.reference.anonymous.restructuredtext'
},
2: {name: 'punctuation.definition.reference.named.restructuredtext'}
},
name: 'meta.link-reference.unquoted.restructuredtext',
patterns: [{match: '[-_.:+][A-Za-z0-9]'}, {include: '#escape'}]
},
'link-target': {