]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/asciidoc.js
1 /*! `asciidoc` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
8 Author: Dan Allen <dan.j.allen@gmail.com>
9 Website: http://asciidoc.org
10 Description: A semantic, text-based document format that can be exported to HTML, DocBook and other backends.
14 /** @type LanguageFn */
15 function asciidoc(hljs
) {
16 const regex
= hljs
.regex
;
17 const HORIZONTAL_RULE
= {
18 begin: '^\'{3,}[ \\t]*$',
21 const ESCAPED_FORMATTING
= [
22 // escaped constrained formatting marks (i.e., \* \_ or \`)
24 // escaped unconstrained formatting marks (i.e., \\** \\__ or \\``)
25 // must ignore until the next formatting marks
26 // this rule might not be 100% compliant with Asciidoctor 2.0 but we are entering undefined behavior territory...
27 { begin: /\\\\\*{2}[^\n]*?\*{2}/ },
28 { begin: /\\\\_{2}[^\n]*_{2}/ },
29 { begin: /\\\\`{2}[^\n]*`{2}/ },
30 // guard: constrained formatting mark may not be preceded by ":", ";" or
31 // "}". match these so the constrained rule doesn't see them
32 { begin: /[:;}][*_`](?![*_`])/ }
35 // inline unconstrained strong (single line)
38 begin: /\*{2}([^\n]+?)\*{2}/
40 // inline unconstrained strong (multi-line)
45 /((\*(?!\*)|\\[^\n]|[^*\n\\])+\n)+/,
46 /(\*(?!\*)|\\[^\n]|[^*\n\\])*/,
51 // inline constrained strong (single line)
54 // must not precede or follow a word character
55 begin: /\B\*(\S|\S[^\n]*?\S)\*(?!\w)/
57 // inline constrained strong (multi-line)
60 // must not precede or follow a word character
61 begin: /\*[^\s]([^\n]+\n)+([^\n]+)\*/
65 // inline unconstrained emphasis (single line)
67 className: 'emphasis',
68 begin: /_{2}([^\n]+?)_{2}/
70 // inline unconstrained emphasis (multi-line)
72 className: 'emphasis',
75 /((_(?!_)|\\[^\n]|[^_\n\\])+\n)+/,
76 /(_(?!_)|\\[^\n]|[^_\n\\])*/,
81 // inline constrained emphasis (single line)
83 className: 'emphasis',
84 // must not precede or follow a word character
85 begin: /\b_(\S|\S[^\n]*?\S)_(?!\w)/
87 // inline constrained emphasis (multi-line)
89 className: 'emphasis',
90 // must not precede or follow a word character
91 begin: /_[^\s]([^\n]+\n)+([^\n]+)_/
93 // inline constrained emphasis using single quote (legacy)
95 className: 'emphasis',
96 // must not follow a word character or be followed by a single quote or space
97 begin: '\\B\'(?![\'\\s])',
99 // allow escaped single quote followed by word char
111 begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+',
114 const BULLET_LIST
= {
116 begin: '^(\\*+|-+|\\.+|[^\\n]+?::)\\s+'
127 // can also be done as...
143 // example, admonition & sidebar blocks
145 begin: '^[=\\*]{4,}\\n',
146 end: '\\n^[=\\*]{4,}$',
151 className: 'section',
154 { begin: '^(={1,6})[ \t].+?([ \t]\\1)?$' },
155 { begin: '^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$' }
158 // document attributes
169 begin: '^\\[.+?\\]$',
179 // listing and literal blocks
182 begin: '^[\\-\\.]{4,}\\n',
183 end: '\\n[\\-\\.]{4,}$',
186 // passthrough blocks
188 begin: '^\\+{4,}\\n',
203 ...ESCAPED_FORMATTING
,
207 // inline smart quotes
211 { begin: "``.+?''" },
215 // inline unconstrained emphasis
221 // inline code snippets (TODO should get same treatment as strong and emphasis)
224 begin: '(`.+?`|\\+.+?\\+)',
227 // indented literal block
237 begin: '(link:)?(http|https|ftp|file|irc|image:?):\\S+?\\[[^[]*?\\]',
241 begin: '(link|image:?):',
269 export default hljsGrammar
;