[d24f17c] | 1 | Prism.languages.rest = {
|
---|
| 2 | 'table': [
|
---|
| 3 | {
|
---|
| 4 | pattern: /(^[\t ]*)(?:\+[=-]+)+\+(?:\r?\n|\r)(?:\1[+|].+[+|](?:\r?\n|\r))+\1(?:\+[=-]+)+\+/m,
|
---|
| 5 | lookbehind: true,
|
---|
| 6 | inside: {
|
---|
| 7 | 'punctuation': /\||(?:\+[=-]+)+\+/
|
---|
| 8 | }
|
---|
| 9 | },
|
---|
| 10 | {
|
---|
| 11 | pattern: /(^[\t ]*)=+ [ =]*=(?:(?:\r?\n|\r)\1.+)+(?:\r?\n|\r)\1=+ [ =]*=(?=(?:\r?\n|\r){2}|\s*$)/m,
|
---|
| 12 | lookbehind: true,
|
---|
| 13 | inside: {
|
---|
| 14 | 'punctuation': /[=-]+/
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
| 17 | ],
|
---|
| 18 |
|
---|
| 19 | // Directive-like patterns
|
---|
| 20 |
|
---|
| 21 | 'substitution-def': {
|
---|
| 22 | pattern: /(^[\t ]*\.\. )\|(?:[^|\s](?:[^|]*[^|\s])?)\| [^:]+::/m,
|
---|
| 23 | lookbehind: true,
|
---|
| 24 | inside: {
|
---|
| 25 | 'substitution': {
|
---|
| 26 | pattern: /^\|(?:[^|\s]|[^|\s][^|]*[^|\s])\|/,
|
---|
| 27 | alias: 'attr-value',
|
---|
| 28 | inside: {
|
---|
| 29 | 'punctuation': /^\||\|$/
|
---|
| 30 | }
|
---|
| 31 | },
|
---|
| 32 | 'directive': {
|
---|
| 33 | pattern: /( )(?! )[^:]+::/,
|
---|
| 34 | lookbehind: true,
|
---|
| 35 | alias: 'function',
|
---|
| 36 | inside: {
|
---|
| 37 | 'punctuation': /::$/
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | },
|
---|
| 42 | 'link-target': [
|
---|
| 43 | {
|
---|
| 44 | pattern: /(^[\t ]*\.\. )\[[^\]]+\]/m,
|
---|
| 45 | lookbehind: true,
|
---|
| 46 | alias: 'string',
|
---|
| 47 | inside: {
|
---|
| 48 | 'punctuation': /^\[|\]$/
|
---|
| 49 | }
|
---|
| 50 | },
|
---|
| 51 | {
|
---|
| 52 | pattern: /(^[\t ]*\.\. )_(?:`[^`]+`|(?:[^:\\]|\\.)+):/m,
|
---|
| 53 | lookbehind: true,
|
---|
| 54 | alias: 'string',
|
---|
| 55 | inside: {
|
---|
| 56 | 'punctuation': /^_|:$/
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | ],
|
---|
| 60 | 'directive': {
|
---|
| 61 | pattern: /(^[\t ]*\.\. )[^:]+::/m,
|
---|
| 62 | lookbehind: true,
|
---|
| 63 | alias: 'function',
|
---|
| 64 | inside: {
|
---|
| 65 | 'punctuation': /::$/
|
---|
| 66 | }
|
---|
| 67 | },
|
---|
| 68 | 'comment': {
|
---|
| 69 | // The two alternatives try to prevent highlighting of blank comments
|
---|
| 70 | pattern: /(^[\t ]*\.\.)(?:(?: .+)?(?:(?:\r?\n|\r).+)+| .+)(?=(?:\r?\n|\r){2}|$)/m,
|
---|
| 71 | lookbehind: true
|
---|
| 72 | },
|
---|
| 73 |
|
---|
| 74 | 'title': [
|
---|
| 75 | // Overlined and underlined
|
---|
| 76 | {
|
---|
| 77 | pattern: /^(([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+)(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
|
---|
| 78 | inside: {
|
---|
| 79 | 'punctuation': /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
|
---|
| 80 | 'important': /.+/
|
---|
| 81 | }
|
---|
| 82 | },
|
---|
| 83 |
|
---|
| 84 | // Underlined only
|
---|
| 85 | {
|
---|
| 86 | pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+(?=\r?\n|\r|$)/,
|
---|
| 87 | lookbehind: true,
|
---|
| 88 | inside: {
|
---|
| 89 | 'punctuation': /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
|
---|
| 90 | 'important': /.+/
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 | ],
|
---|
| 94 | 'hr': {
|
---|
| 95 | pattern: /((?:\r?\n|\r){2})([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2{3,}(?=(?:\r?\n|\r){2})/,
|
---|
| 96 | lookbehind: true,
|
---|
| 97 | alias: 'punctuation'
|
---|
| 98 | },
|
---|
| 99 | 'field': {
|
---|
| 100 | pattern: /(^[\t ]*):[^:\r\n]+:(?= )/m,
|
---|
| 101 | lookbehind: true,
|
---|
| 102 | alias: 'attr-name'
|
---|
| 103 | },
|
---|
| 104 | 'command-line-option': {
|
---|
| 105 | pattern: /(^[\t ]*)(?:[+-][a-z\d]|(?:--|\/)[a-z\d-]+)(?:[ =](?:[a-z][\w-]*|<[^<>]+>))?(?:, (?:[+-][a-z\d]|(?:--|\/)[a-z\d-]+)(?:[ =](?:[a-z][\w-]*|<[^<>]+>))?)*(?=(?:\r?\n|\r)? {2,}\S)/im,
|
---|
| 106 | lookbehind: true,
|
---|
| 107 | alias: 'symbol'
|
---|
| 108 | },
|
---|
| 109 | 'literal-block': {
|
---|
| 110 | pattern: /::(?:\r?\n|\r){2}([ \t]+)(?![ \t]).+(?:(?:\r?\n|\r)\1.+)*/,
|
---|
| 111 | inside: {
|
---|
| 112 | 'literal-block-punctuation': {
|
---|
| 113 | pattern: /^::/,
|
---|
| 114 | alias: 'punctuation'
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 | },
|
---|
| 118 | 'quoted-literal-block': {
|
---|
| 119 | pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]).*(?:(?:\r?\n|\r)\1.*)*/,
|
---|
| 120 | inside: {
|
---|
| 121 | 'literal-block-punctuation': {
|
---|
| 122 | pattern: /^(?:::|([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\1*)/m,
|
---|
| 123 | alias: 'punctuation'
|
---|
| 124 | }
|
---|
| 125 | }
|
---|
| 126 | },
|
---|
| 127 | 'list-bullet': {
|
---|
| 128 | pattern: /(^[\t ]*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d+|[a-z]|[ivxdclm]+)\.)(?= )/im,
|
---|
| 129 | lookbehind: true,
|
---|
| 130 | alias: 'punctuation'
|
---|
| 131 | },
|
---|
| 132 | 'doctest-block': {
|
---|
| 133 | pattern: /(^[\t ]*)>>> .+(?:(?:\r?\n|\r).+)*/m,
|
---|
| 134 | lookbehind: true,
|
---|
| 135 | inside: {
|
---|
| 136 | 'punctuation': /^>>>/
|
---|
| 137 | }
|
---|
| 138 | },
|
---|
| 139 |
|
---|
| 140 | 'inline': [
|
---|
| 141 | {
|
---|
| 142 | pattern: /(^|[\s\-:\/'"<(\[{])(?::[^:]+:`.*?`|`.*?`:[^:]+:|(\*\*?|``?|\|)(?!\s)(?:(?!\2).)*\S\2(?=[\s\-.,:;!?\\\/'")\]}]|$))/m,
|
---|
| 143 | lookbehind: true,
|
---|
| 144 | inside: {
|
---|
| 145 | 'bold': {
|
---|
| 146 | pattern: /(^\*\*).+(?=\*\*$)/,
|
---|
| 147 | lookbehind: true
|
---|
| 148 | },
|
---|
| 149 | 'italic': {
|
---|
| 150 | pattern: /(^\*).+(?=\*$)/,
|
---|
| 151 | lookbehind: true
|
---|
| 152 | },
|
---|
| 153 | 'inline-literal': {
|
---|
| 154 | pattern: /(^``).+(?=``$)/,
|
---|
| 155 | lookbehind: true,
|
---|
| 156 | alias: 'symbol'
|
---|
| 157 | },
|
---|
| 158 | 'role': {
|
---|
| 159 | pattern: /^:[^:]+:|:[^:]+:$/,
|
---|
| 160 | alias: 'function',
|
---|
| 161 | inside: {
|
---|
| 162 | 'punctuation': /^:|:$/
|
---|
| 163 | }
|
---|
| 164 | },
|
---|
| 165 | 'interpreted-text': {
|
---|
| 166 | pattern: /(^`).+(?=`$)/,
|
---|
| 167 | lookbehind: true,
|
---|
| 168 | alias: 'attr-value'
|
---|
| 169 | },
|
---|
| 170 | 'substitution': {
|
---|
| 171 | pattern: /(^\|).+(?=\|$)/,
|
---|
| 172 | lookbehind: true,
|
---|
| 173 | alias: 'attr-value'
|
---|
| 174 | },
|
---|
| 175 | 'punctuation': /\*\*?|``?|\|/
|
---|
| 176 | }
|
---|
| 177 | }
|
---|
| 178 | ],
|
---|
| 179 |
|
---|
| 180 | 'link': [
|
---|
| 181 | {
|
---|
| 182 | pattern: /\[[^\[\]]+\]_(?=[\s\-.,:;!?\\\/'")\]}]|$)/,
|
---|
| 183 | alias: 'string',
|
---|
| 184 | inside: {
|
---|
| 185 | 'punctuation': /^\[|\]_$/
|
---|
| 186 | }
|
---|
| 187 | },
|
---|
| 188 | {
|
---|
| 189 | pattern: /(?:\b[a-z\d]+(?:[_.:+][a-z\d]+)*_?_|`[^`]+`_?_|_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
|
---|
| 190 | alias: 'string',
|
---|
| 191 | inside: {
|
---|
| 192 | 'punctuation': /^_?`|`$|`?_?_$/
|
---|
| 193 | }
|
---|
| 194 | }
|
---|
| 195 | ],
|
---|
| 196 |
|
---|
| 197 | // Line block start,
|
---|
| 198 | // quote attribution,
|
---|
| 199 | // explicit markup start,
|
---|
| 200 | // and anonymous hyperlink target shortcut (__)
|
---|
| 201 | 'punctuation': {
|
---|
| 202 | pattern: /(^[\t ]*)(?:\|(?= |$)|(?:---?|—|\.\.|__)(?= )|\.\.$)/m,
|
---|
| 203 | lookbehind: true
|
---|
| 204 | }
|
---|
| 205 | };
|
---|