Mercurial > vim
comparison runtime/syntax/pandoc.vim @ 34807:7f709fa537df v9.1.0276
patch 9.1.0276: No pandoc syntax support
Commit: https://github.com/vim/vim/commit/7005b7ee7f282b24378c2a844366cb8616cad5d7
Author: Wu, Zhenyu <wuzhenyu@ustc.edu>
Date: Mon Apr 8 20:53:19 2024 +0200
patch 9.1.0276: No pandoc syntax support
Problem: No pandoc syntax support
Solution: Add pandoc syntax and compiler plugins
(Wu, Zhenyu, Konfekt)
closes: #14389
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 08 Apr 2024 22:00:03 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
34806:33cac3f2dec5 | 34807:7f709fa537df |
---|---|
1 scriptencoding utf-8 | |
2 " | |
3 " Language: Pandoc (superset of Markdown) | |
4 " Maintainer: Felipe Morales <hel.sheep@gmail.com> | |
5 " Maintainer: Caleb Maclennan <caleb@alerque.com> | |
6 " Upstream: https://github.com/vim-pandoc/vim-pandoc-syntax | |
7 " | |
8 " Contributor: David Sanson <dsanson@gmail.com> | |
9 " Jorge Israel Peña <jorge.israel.p@gmail.com> | |
10 " Original Author: Jeremy Schultz <taozhyn@gmail.com> | |
11 " Version: 5.0 | |
12 " Last Change: 2024 Apr 08 | |
13 | |
14 let s:cpo_save = &cpo | |
15 set cpo&vim | |
16 | |
17 " Configuration: {{{1 | |
18 " | |
19 " use conceal? {{{2 | |
20 if !exists('g:pandoc#syntax#conceal#use') | |
21 let g:pandoc#syntax#conceal#use = 1 | |
22 endif | |
23 "}}}2 | |
24 | |
25 " what groups not to use conceal in. works as a blacklist {{{2 | |
26 if !exists('g:pandoc#syntax#conceal#blacklist') | |
27 let g:pandoc#syntax#conceal#blacklist = [] | |
28 endif | |
29 " }}}2 | |
30 | |
31 " cchars used in conceal rules {{{2 | |
32 " utf-8 defaults (preferred) | |
33 if &encoding ==# 'utf-8' | |
34 let s:cchars = { | |
35 \'newline': '↵', | |
36 \'image': '▨', | |
37 \'super': 'ⁿ', | |
38 \'sub': 'ₙ', | |
39 \'strike': 'x̶', | |
40 \'atx': '§', | |
41 \'codelang': 'λ', | |
42 \'codeend': '—', | |
43 \'abbrev': '→', | |
44 \'footnote': '†', | |
45 \'definition': ' ', | |
46 \'li': '•', | |
47 \'html_c_s': '‹', | |
48 \'html_c_e': '›', | |
49 \'quote_s': '“', | |
50 \'quote_e': '”'} | |
51 else | |
52 " ascii defaults | |
53 let s:cchars = { | |
54 \'newline': ' ', | |
55 \'image': 'i', | |
56 \'super': '^', | |
57 \'sub': '_', | |
58 \'strike': '~', | |
59 \'atx': '#', | |
60 \'codelang': 'l', | |
61 \'codeend': '-', | |
62 \'abbrev': 'a', | |
63 \'footnote': 'f', | |
64 \'definition': ' ', | |
65 \'li': '*', | |
66 \'html_c_s': '+', | |
67 \'html_c_e': '+'} | |
68 endif | |
69 " }}}2 | |
70 | |
71 " if the user has a dictionary with replacements for the default cchars, use those {{{2 | |
72 if exists('g:pandoc#syntax#conceal#cchar_overrides') | |
73 let s:cchars = extend(s:cchars, g:pandoc#syntax#conceal#cchar_overrides) | |
74 endif | |
75 " }}}2 | |
76 | |
77 "should the urls in links be concealed? {{{2 | |
78 if !exists('g:pandoc#syntax#conceal#urls') | |
79 let g:pandoc#syntax#conceal#urls = 0 | |
80 endif | |
81 " should backslashes in escapes be concealed? {{{2 | |
82 if !exists('g:pandoc#syntax#conceal#backslash') | |
83 let g:pandoc#syntax#conceal#backslash = 0 | |
84 endif | |
85 " }}}2 | |
86 | |
87 " leave specified codeblocks as Normal (i.e. 'unhighlighted') {{{2 | |
88 if !exists('g:pandoc#syntax#codeblocks#ignore') | |
89 let g:pandoc#syntax#codeblocks#ignore = [] | |
90 endif | |
91 " }}}2 | |
92 | |
93 " use embedded highlighting for delimited codeblocks where a language is specifed. {{{2 | |
94 if !exists('g:pandoc#syntax#codeblocks#embeds#use') | |
95 let g:pandoc#syntax#codeblocks#embeds#use = 1 | |
96 endif | |
97 " }}}2 | |
98 | |
99 " for what languages and using what vim syntax files highlight those embeds. {{{2 | |
100 " defaults to None. | |
101 if !exists('g:pandoc#syntax#codeblocks#embeds#langs') | |
102 let g:pandoc#syntax#codeblocks#embeds#langs = [] | |
103 endif | |
104 " }}}2 | |
105 | |
106 " use italics ? {{{2 | |
107 if !exists('g:pandoc#syntax#style#emphases') | |
108 let g:pandoc#syntax#style#emphases = 1 | |
109 endif | |
110 " if 0, we don't conceal the emphasis marks, otherwise there wouldn't be a way | |
111 " to tell where the styles apply. | |
112 if g:pandoc#syntax#style#emphases == 0 | |
113 call add(g:pandoc#syntax#conceal#blacklist, 'block') | |
114 endif | |
115 " }}}2 | |
116 | |
117 " underline subscript, superscript and strikeout? {{{2 | |
118 if !exists('g:pandoc#syntax#style#underline_special') | |
119 let g:pandoc#syntax#style#underline_special = 1 | |
120 endif | |
121 " }}}2 | |
122 | |
123 " protect code blocks? {{{2 | |
124 if !exists('g:pandoc#syntax#protect#codeblocks') | |
125 let g:pandoc#syntax#protect#codeblocks = 1 | |
126 endif | |
127 " }}}2 | |
128 | |
129 " use color column? {{{2 | |
130 if !exists('g:pandoc#syntax#colorcolumn') | |
131 let g:pandoc#syntax#colorcolumn = 0 | |
132 endif | |
133 " }}}2 | |
134 | |
135 " highlight new lines? {{{2 | |
136 if !exists('g:pandoc#syntax#newlines') | |
137 let g:pandoc#syntax#newlines = 1 | |
138 endif | |
139 " }}} | |
140 | |
141 " detect roman-numeral list items? {{{2 | |
142 if !exists('g:pandoc#syntax#roman_lists') | |
143 let g:pandoc#syntax#roman_lists = 0 | |
144 endif | |
145 " }}}2 | |
146 | |
147 " disable syntax highlighting for definition lists? (better performances) {{{2 | |
148 if !exists('g:pandoc#syntax#use_definition_lists') | |
149 let g:pandoc#syntax#use_definition_lists = 1 | |
150 endif | |
151 " }}}2 | |
152 | |
153 " }}}1 | |
154 | |
155 " Functions: {{{1 | |
156 " EnableEmbedsforCodeblocksWithLang {{{2 | |
157 function! EnableEmbedsforCodeblocksWithLang(entry) | |
158 " prevent embedded language syntaxes from changing 'foldmethod' | |
159 if has('folding') | |
160 let s:foldmethod = &l:foldmethod | |
161 let s:foldtext = &l:foldtext | |
162 endif | |
163 | |
164 try | |
165 let s:langname = matchstr(a:entry, '^[^=]*') | |
166 let s:langsyntaxfile = matchstr(a:entry, '[^=]*$') | |
167 unlet! b:current_syntax | |
168 exe 'syn include @'.toupper(s:langname).' syntax/'.s:langsyntaxfile.'.vim' | |
169 " We might have just turned off spellchecking by including the file, | |
170 " so we turn it back on here. | |
171 exe 'syntax spell toplevel' | |
172 exe 'syn region pandocDelimitedCodeBlock_' . s:langname . ' start=/\(\_^\( \+\|\t\)\=\(`\{3,}`*\|\~\{3,}\~*\)\s*\%({[^.]*\.\)\=' . s:langname . '\>.*\n\)\@<=\_^/' . | |
173 \' end=/\_$\n\(\( \+\|\t\)\=\(`\{3,}`*\|\~\{3,}\~*\)\_$\n\_$\)\@=/ contained containedin=pandocDelimitedCodeBlock' . | |
174 \' contains=@' . toupper(s:langname) | |
175 exe 'syn region pandocDelimitedCodeBlockinBlockQuote_' . s:langname . ' start=/>\s\(`\{3,}`*\|\~\{3,}\~*\)\s*\%({[^.]*\.\)\=' . s:langname . '\>/' . | |
176 \ ' end=/\(`\{3,}`*\|\~\{3,}\~*\)/ contained containedin=pandocDelimitedCodeBlock' . | |
177 \' contains=@' . toupper(s:langname) . | |
178 \',pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd,pandodDelimitedCodeblockLang,pandocBlockQuoteinDelimitedCodeBlock' | |
179 catch /E484/ | |
180 echo "No syntax file found for '" . s:langsyntaxfile . "'" | |
181 endtry | |
182 | |
183 if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod | |
184 let &l:foldmethod = s:foldmethod | |
185 endif | |
186 if exists('s:foldtext') && s:foldtext !=# &l:foldtext | |
187 let &l:foldtext = s:foldtext | |
188 endif | |
189 endfunction | |
190 " }}}2 | |
191 | |
192 " DisableEmbedsforCodeblocksWithLang {{{2 | |
193 function! DisableEmbedsforCodeblocksWithLang(langname) | |
194 try | |
195 exe 'syn clear pandocDelimitedCodeBlock_'.a:langname | |
196 exe 'syn clear pandocDelimitedCodeBlockinBlockQuote_'.a:langname | |
197 catch /E28/ | |
198 echo "No existing highlight definitions found for '" . a:langname . "'" | |
199 endtry | |
200 endfunction | |
201 " }}}2 | |
202 | |
203 " WithConceal {{{2 | |
204 function! s:WithConceal(rule_group, rule, conceal_rule) | |
205 let l:rule_tail = '' | |
206 if g:pandoc#syntax#conceal#use != 0 | |
207 if index(g:pandoc#syntax#conceal#blacklist, a:rule_group) == -1 | |
208 let l:rule_tail = ' ' . a:conceal_rule | |
209 endif | |
210 endif | |
211 execute a:rule . l:rule_tail | |
212 endfunction | |
213 " }}}2 | |
214 | |
215 " }}}1 | |
216 | |
217 " Commands: {{{1 | |
218 command! -buffer -nargs=1 -complete=syntax PandocHighlight call EnableEmbedsforCodeblocksWithLang(<f-args>) | |
219 command! -buffer -nargs=1 -complete=syntax PandocUnhighlight call DisableEmbedsforCodeblocksWithLang(<f-args>) | |
220 " }}}1 | |
221 | |
222 " BASE: | |
223 syntax clear | |
224 syntax spell toplevel | |
225 " }}}1 | |
226 | |
227 " Syntax Rules: {{{1 | |
228 | |
229 " Embeds: {{{2 | |
230 | |
231 " prevent embedded language syntaxes from changing 'foldmethod' | |
232 if has('folding') | |
233 let s:foldmethod = &l:foldmethod | |
234 endif | |
235 | |
236 " HTML: {{{3 | |
237 " Set embedded HTML highlighting | |
238 syn include @HTML syntax/html.vim | |
239 syn match pandocHTML /<\/\?\a\_.\{-}>/ contains=@HTML | |
240 " Support HTML multi line comments | |
241 syn region pandocHTMLComment start=/<!--\s\=/ end=/\s\=-->/ keepend contains=pandocHTMLCommentStart,pandocHTMLCommentEnd | |
242 call s:WithConceal('html_c_s', 'syn match pandocHTMLCommentStart /<!--/ contained', 'conceal cchar='.s:cchars['html_c_s']) | |
243 call s:WithConceal('html_c_e', 'syn match pandocHTMLCommentEnd /-->/ contained', 'conceal cchar='.s:cchars['html_c_e']) | |
244 " }}}3 | |
245 | |
246 " LaTeX: {{{3 | |
247 " Set embedded LaTex (pandoc extension) highlighting | |
248 " Unset current_syntax so the 2nd include will work | |
249 unlet b:current_syntax | |
250 syn include @LATEX syntax/tex.vim | |
251 if index(g:pandoc#syntax#conceal#blacklist, 'inlinemath') == -1 | |
252 " Can't use WithConceal here because it will mess up all other conceals | |
253 " when dollar signs are used normally. It must be skipped entirely if | |
254 " inlinemath is blacklisted | |
255 syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX | |
256 syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX | |
257 endif | |
258 syn match pandocEscapedDollar /\\\$/ conceal cchar=$ | |
259 syn match pandocProtectedFromInlineLaTeX /\\\@<!\${.*}\(\(\s\|[[:punct:]]\)\([^$]*\|.*\(\\\$.*\)\{2}\)\n\n\|$\)\@=/ display | |
260 " contains=@LATEX | |
261 syn region pandocLaTeXMathBlock start=/\$\$/ end=/\$\$/ keepend contains=@LATEX | |
262 syn region pandocLaTeXMathBlock start=/\\\@<!\\\[/ end=/\\\@<!\\\]/ keepend contains=@LATEX | |
263 syn match pandocLaTeXCommand /\\[[:alpha:]]\+\(\({.\{-}}\)\=\(\[.\{-}\]\)\=\)*/ contains=@LATEX | |
264 syn region pandocLaTeXRegion start=/\\begin{\z(.\{-}\)}/ end=/\\end{\z1}/ keepend contains=@LATEX | |
265 " we rehighlight sectioning commands, because otherwise tex.vim captures all text until EOF or a new sectioning command | |
266 syn region pandocLaTexSection start=/\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)\=paragraph\)\*\=\(\[.*\]\)\={/ end=/\}/ keepend | |
267 syn match pandocLaTexSectionCmd /\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)\=paragraph\)/ contained containedin=pandocLaTexSection | |
268 syn match pandocLaTeXDelimiter /[[\]{}]/ contained containedin=pandocLaTexSection | |
269 " }}}3 | |
270 | |
271 if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod | |
272 let &l:foldmethod = s:foldmethod | |
273 endif | |
274 | |
275 " }}}2 | |
276 | |
277 " Titleblock: {{{2 | |
278 syn region pandocTitleBlock start=/\%^%/ end=/\n\n/ contains=pandocReferenceLabel,pandocReferenceURL,pandocNewLine | |
279 call s:WithConceal('titleblock', 'syn match pandocTitleBlockMark /%\ / contained containedin=pandocTitleBlock,pandocTitleBlockTitle', 'conceal') | |
280 syn match pandocTitleBlockTitle /\%^%.*\n/ contained containedin=pandocTitleBlock | |
281 " }}}2 | |
282 | |
283 " Blockquotes: {{{2 | |
284 syn match pandocBlockQuote /^\s\{,3}>.*\n\(.*\n\@1<!\n\)*/ contains=@Spell,pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted,pandocAmpersandEscape,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion skipnl | |
285 syn match pandocBlockQuoteMark /\_^\s\{,3}>/ contained containedin=pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted | |
286 " }}}2 | |
287 | |
288 " Code Blocks: {{{2 | |
289 if g:pandoc#syntax#protect#codeblocks == 1 | |
290 syn match pandocCodeblock /\([ ]\{4}\|\t\).*$/ | |
291 endif | |
292 syn region pandocCodeBlockInsideIndent start=/\(\(\d\|\a\|*\).*\n\)\@<!\(^\(\s\{8,}\|\t\+\)\).*\n/ end=/.\(\n^\s*\n\)\@=/ contained | |
293 " }}}2 | |
294 | |
295 " Links: {{{2 | |
296 | |
297 " Base: {{{3 | |
298 syn region pandocReferenceLabel matchgroup=pandocOperator start=/!\{,1}\\\@<!\^\@<!\[/ skip=/\(\\\@<!\]\]\@=\|`.*\\\@<!].*`\)/ end=/\\\@<!\]/ keepend display | |
299 if g:pandoc#syntax#conceal#urls == 1 | |
300 syn region pandocReferenceURL matchgroup=pandocOperator start=/\]\@1<=(/ end=/)/ keepend conceal | |
301 else | |
302 syn region pandocReferenceURL matchgroup=pandocOperator start=/\]\@1<=(/ end=/)/ keepend | |
303 endif | |
304 " let's not consider "a [label] a" as a label, remove formatting - Note: breaks implicit links | |
305 syn match pandocNoLabel /\]\@1<!\(\s\{,3}\|^\)\[[^\[\]]\{-}\]\(\s\+\|$\)[\[(]\@!/ contains=pandocPCite | |
306 syn match pandocLinkTip /\s*".\{-}"/ contained containedin=pandocReferenceURL contains=@Spell,pandocAmpersandEscape display | |
307 call s:WithConceal('image', 'syn match pandocImageIcon /!\[\@=/ display', 'conceal cchar='. s:cchars['image']) | |
308 " }}}3 | |
309 | |
310 " Definitions: {{{3 | |
311 syn region pandocReferenceDefinition start=/\[.\{-}\]:/ end=/\(\n\s*".*"$\|$\)/ keepend | |
312 syn match pandocReferenceDefinitionLabel /\[\zs.\{-}\ze\]:/ contained containedin=pandocReferenceDefinition display | |
313 syn match pandocReferenceDefinitionAddress /:\s*\zs.*/ contained containedin=pandocReferenceDefinition | |
314 syn match pandocReferenceDefinitionTip /\s*".\{-}"/ contained containedin=pandocReferenceDefinition,pandocReferenceDefinitionAddress contains=@Spell,pandocAmpersandEscape | |
315 " }}}3 | |
316 | |
317 " Automatic_links: {{{3 | |
318 syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE | |
319 " }}}3 | |
320 | |
321 " }}}2 | |
322 | |
323 " Citations: {{{2 | |
324 " parenthetical citations | |
325 syn match pandocPCite "\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*.\{-}\]" contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display | |
326 " in-text citations with location | |
327 syn match pandocICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=pandocCiteKey,@Spell display | |
328 " cite keys | |
329 syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display | |
330 syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display | |
331 syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite | |
332 " }}}2 | |
333 | |
334 " Text Styles: {{{2 | |
335 | |
336 " Emphasis: {{{3 | |
337 call s:WithConceal('block', 'syn region pandocEmphasis matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends') | |
338 call s:WithConceal('block', 'syn region pandocEmphasis matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends') | |
339 " }}}3 | |
340 | |
341 " Strong: {{{3 | |
342 call s:WithConceal('block', 'syn region pandocStrong matchgroup=pandocOperator start=/\(\\\@<!\*\)\{2}/ end=/\(\\\@<!\*\)\{2}/ contains=@Spell,pandocNoFormattedInStrong,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends') | |
343 call s:WithConceal('block', 'syn region pandocStrong matchgroup=pandocOperator start=/__/ end=/__/ contains=@Spell,pandocNoFormattedInStrong,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends') | |
344 " }}}3 | |
345 | |
346 " Strong Emphasis: {{{3 | |
347 call s:WithConceal('block', 'syn region pandocStrongEmphasis matchgroup=pandocOperator start=/\*\{3}\(\S[^*]*\(\*\S\|\n[^*]*\*\S\)\)\@=/ end=/\S\@<=\*\{3}/ contains=@Spell,pandocAmpersandEscape', 'concealends') | |
348 call s:WithConceal('block', 'syn region pandocStrongEmphasis matchgroup=pandocOperator start=/\(___\)\S\@=/ end=/\S\@<=___/ contains=@Spell,pandocAmpersandEscape', 'concealends') | |
349 " }}}3 | |
350 | |
351 " Mixed: {{{3 | |
352 call s:WithConceal('block', 'syn region pandocStrongInEmphasis matchgroup=pandocOperator start=/\*\*/ end=/\*\*/ contained containedin=pandocEmphasis contains=@Spell,pandocAmpersandEscape', 'concealends') | |
353 call s:WithConceal('block', 'syn region pandocStrongInEmphasis matchgroup=pandocOperator start=/__/ end=/__/ contained containedin=pandocEmphasis contains=@Spell,pandocAmpersandEscape', 'concealends') | |
354 call s:WithConceal('block', 'syn region pandocEmphasisInStrong matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=pandocStrong contains=@Spell,pandocAmpersandEscape', 'concealends') | |
355 call s:WithConceal('block', 'syn region pandocEmphasisInStrong matchgroup=pandocOperator start=/\\\@<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=_\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=pandocStrong contains=@Spell,pandocAmpersandEscape', 'concealends') | |
356 " }}}3 | |
357 | |
358 " Inline Code: {{{3 | |
359 " Using single back ticks | |
360 call s:WithConceal('inlinecode', 'syn region pandocNoFormatted matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs', 'concealends') | |
361 call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInEmphasis matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs contained', 'concealends') | |
362 call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInStrong matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs contained', 'concealends') | |
363 " Using double back ticks | |
364 call s:WithConceal('inlinecode', 'syn region pandocNoFormatted matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs', 'concealends') | |
365 call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInEmphasis matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs contained', 'concealends') | |
366 call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInStrong matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs contained', 'concealends') | |
367 syn match pandocNoFormattedAttrs /{.\{-}}/ contained | |
368 " }}}3 | |
369 | |
370 " Subscripts: {{{3 | |
371 syn region pandocSubscript start=/\~\(\([[:graph:]]\(\\ \)\=\)\{-}\~\)\@=/ end=/\~/ keepend | |
372 call s:WithConceal('subscript', 'syn match pandocSubscriptMark /\~/ contained containedin=pandocSubscript', 'conceal cchar='.s:cchars['sub']) | |
373 " }}}3 | |
374 | |
375 " Superscript: {{{3 | |
376 syn region pandocSuperscript start=/\^\(\([[:graph:]]\(\\ \)\=\)\{-}\^\)\@=/ skip=/\\ / end=/\^/ keepend | |
377 call s:WithConceal('superscript', 'syn match pandocSuperscriptMark /\^/ contained containedin=pandocSuperscript', 'conceal cchar='.s:cchars['super']) | |
378 " }}}3 | |
379 | |
380 " Strikeout: {{{3 | |
381 syn region pandocStrikeout start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend | |
382 call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained containedin=pandocStrikeout', 'conceal cchar='.s:cchars['strike']) | |
383 " }}}3 | |
384 | |
385 " }}}2 | |
386 | |
387 " Headers: {{{2 | |
388 syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display | |
389 syn match pandocAtxHeaderMark /\(^#\{1,6}\|\\\@<!#\+\(\s*.*$\)\@=\)/ contained containedin=pandocAtxHeader | |
390 call s:WithConceal('atx', 'syn match pandocAtxStart /#/ contained containedin=pandocAtxHeaderMark', 'conceal cchar='.s:cchars['atx']) | |
391 syn match pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape | |
392 syn match pandocSetexHeader /^.\+\n[-]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape | |
393 syn match pandocHeaderAttr /{.*}/ contained containedin=pandocAtxHeader,pandocSetexHeader | |
394 syn match pandocHeaderID /#[-_:.[:lower:][:upper:]]*/ contained containedin=pandocHeaderAttr | |
395 " }}}2 | |
396 | |
397 " Line Blocks: {{{2 | |
398 syn region pandocLineBlock start=/^|/ end=/\(^|\(.*\n|\@!\)\@=.*\)\@<=\n/ transparent | |
399 syn match pandocLineBlockDelimiter /^|/ contained containedin=pandocLineBlock | |
400 " }}}2 | |
401 | |
402 " Tables: {{{2 | |
403 | |
404 " Simple: {{{3 | |
405 syn region pandocSimpleTable start=/\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)\(-\{2,}\s*\)\+\n\n\@!/ end=/\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocDelimitedCodeBlockStart,pandocYAMLHeader keepend | |
406 syn match pandocSimpleTableDelims /\-/ contained containedin=pandocSimpleTable | |
407 syn match pandocSimpleTableHeader /\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)/ contained containedin=pandocSimpleTable | |
408 | |
409 syn region pandocTable start=/\%#=2^\(-\{2,}\s*\)\+\n\n\@!/ end=/\%#=2^\(-\{2,}\s*\)\+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend | |
410 syn match pandocTableDelims /\-/ contained containedin=pandocTable | |
411 syn region pandocTableMultilineHeader start=/\%#=2\(^-\{2,}\n\)\@<=./ end=/\%#=2\n-\@=/ contained containedin=pandocTable | |
412 " }}}3 | |
413 | |
414 " Grid: {{{3 | |
415 syn region pandocGridTable start=/\%#=2\n\@1<=+-/ end=/+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend | |
416 syn match pandocGridTableDelims /[\|=]/ contained containedin=pandocGridTable | |
417 syn match pandocGridTableDelims /\%#=2\([\-+][\-+=]\@=\|[\-+=]\@1<=[\-+]\)/ contained containedin=pandocGridTable | |
418 syn match pandocGridTableHeader /\%#=2\(^.*\n\)\(+=.*\)\@=/ contained containedin=pandocGridTable | |
419 " }}}3 | |
420 | |
421 " Pipe: {{{3 | |
422 " with beginning and end pipes | |
423 syn region pandocPipeTable start=/\%#=2\([+|]\n\)\@<!\n\@1<=|\(.*|\)\@=/ end=/|.*\n\(\n\|{\)/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend | |
424 " without beginning and end pipes | |
425 syn region pandocPipeTable start=/\%#=2^.*\n-.\{-}|/ end=/|.*\n\n/ keepend | |
426 syn match pandocPipeTableDelims /[\|\-:+]/ contained containedin=pandocPipeTable | |
427 syn match pandocPipeTableHeader /\(^.*\n\)\(|-\)\@=/ contained containedin=pandocPipeTable | |
428 syn match pandocPipeTableHeader /\(^.*\n\)\(-\)\@=/ contained containedin=pandocPipeTable | |
429 " }}}3 | |
430 | |
431 syn match pandocTableHeaderWord /\<.\{-}\>/ contained containedin=pandocGridTableHeader,pandocPipeTableHeader contains=@Spell | |
432 " }}}2 | |
433 | |
434 " Delimited Code Blocks: {{{2 | |
435 " this is here because we can override strikeouts and subscripts | |
436 syn region pandocDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=\~\{3,}\~*\)/ end=/^\z1\~*/ skipnl contains=pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd keepend | |
437 syn region pandocDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=`\{3,}`*\)/ end=/^\z1`*/ skipnl contains=pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd keepend | |
438 call s:WithConceal('codeblock_start', 'syn match pandocDelimitedCodeBlockStart /\(\(\_^\n\_^\|\%^\)\(>\s\)\?\( \+\|\t\)\=\)\@<=\(\~\{3,}\~*\|`\{3,}`*\)/ contained containedin=pandocDelimitedCodeBlock nextgroup=pandocDelimitedCodeBlockLanguage', 'conceal cchar='.s:cchars['codelang']) | |
439 syn match pandocDelimitedCodeBlockLanguage /\(\s\?\)\@<=.\+\(\_$\)\@=/ contained | |
440 call s:WithConceal('codeblock_delim', 'syn match pandocDelimitedCodeBlockEnd /\(`\{3,}`*\|\~\{3,}\~*\)\(\_$\n\(>\s\)\?\_$\)\@=/ contained containedin=pandocDelimitedCodeBlock', 'conceal cchar='.s:cchars['codeend']) | |
441 syn match pandocBlockQuoteinDelimitedCodeBlock '^>' contained containedin=pandocDelimitedCodeBlock | |
442 syn match pandocCodePre /<pre>.\{-}<\/pre>/ skipnl | |
443 syn match pandocCodePre /<code>.\{-}<\/code>/ skipnl | |
444 | |
445 " enable highlighting for embedded region in codeblocks if there exists a | |
446 " g:pandoc#syntax#codeblocks#embeds#langs *list*. | |
447 " | |
448 " entries in this list are the language code interpreted by pandoc, | |
449 " if this differs from the name of the vim syntax file, append =vimname | |
450 " e.g. let g:pandoc#syntax#codeblocks#embeds#langs = ["haskell", "literatehaskell=lhaskell"] | |
451 " | |
452 if g:pandoc#syntax#codeblocks#embeds#use != 0 | |
453 for l in g:pandoc#syntax#codeblocks#embeds#langs | |
454 call EnableEmbedsforCodeblocksWithLang(l) | |
455 endfor | |
456 endif | |
457 " }}}2 | |
458 | |
459 " Abbreviations: {{{2 | |
460 syn region pandocAbbreviationDefinition start=/^\*\[.\{-}\]:\s*/ end='$' contains=pandocNoFormatted,@Spell,pandocAmpersandEscape | |
461 call s:WithConceal('abbrev', 'syn match pandocAbbreviationSeparator /:/ contained containedin=pandocAbbreviationDefinition', 'conceal cchar='.s:cchars['abbrev']) | |
462 syn match pandocAbbreviation /\*\[.\{-}\]/ contained containedin=pandocAbbreviationDefinition | |
463 call s:WithConceal('abbrev', 'syn match pandocAbbreviationHead /\*\[/ contained containedin=pandocAbbreviation', 'conceal') | |
464 call s:WithConceal('abbrev', 'syn match pandocAbbreviationTail /\]/ contained containedin=pandocAbbreviation', 'conceal') | |
465 " }}}2 | |
466 | |
467 " Footnotes: {{{2 | |
468 " we put these here not to interfere with superscripts. | |
469 syn match pandocFootnoteID /\[\^[^\]]\+\]/ nextgroup=pandocFootnoteDef | |
470 | |
471 " Inline footnotes | |
472 syn region pandocFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocStrongEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocEllipses,pandocBeginQuote,pandocEndQuote,@Spell,pandocAmpersandEscape skipnl keepend | |
473 call s:WithConceal('footnote', 'syn match pandocFootnoteDefHead /\^\[/ contained containedin=pandocFootnoteDef', 'conceal cchar='.s:cchars['footnote']) | |
474 call s:WithConceal('footnote', 'syn match pandocFootnoteDefTail /\]/ contained containedin=pandocFootnoteDef', 'conceal') | |
475 | |
476 " regular footnotes | |
477 syn region pandocFootnoteBlock start=/\[\^.\{-}\]:\s*\n*/ end=/^\n^\s\@!/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocNewLine,pandocStrongEmphasis,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion,pandocAmpersandEscape,@Spell skipnl | |
478 syn match pandocFootnoteBlockSeparator /:/ contained containedin=pandocFootnoteBlock | |
479 syn match pandocFootnoteID /\[\^.\{-}\]/ contained containedin=pandocFootnoteBlock | |
480 call s:WithConceal('footnote', 'syn match pandocFootnoteIDHead /\[\^/ contained containedin=pandocFootnoteID', 'conceal cchar='.s:cchars['footnote']) | |
481 call s:WithConceal('footnote', 'syn match pandocFootnoteIDTail /\]/ contained containedin=pandocFootnoteID', 'conceal') | |
482 " }}}2 | |
483 | |
484 " List Items: {{{2 | |
485 " Unordered lists | |
486 syn match pandocUListItem /^>\=\s*[*+-]\s\+-\@!.*$/ nextgroup=pandocUListItem,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocReferenceURL,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape skipempty display | |
487 call s:WithConceal('list', 'syn match pandocUListItemBullet /^>\=\s*\zs[*+-]/ contained containedin=pandocUListItem', 'conceal cchar='.s:cchars['li']) | |
488 | |
489 " Ordered lists | |
490 syn match pandocListItem /^\s*(\?\(\d\+\|\l\|\#\|@\)[.)].*$/ nextgroup=pandocListItem,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape skipempty display | |
491 | |
492 " support for roman numerals up to 'c' | |
493 if g:pandoc#syntax#roman_lists != 0 | |
494 syn match pandocListItem /^\s*(\?x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}[.)].*$/ nextgroup=pandocListItem,pandocMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation,pandocAutomaticLink skipempty display | |
495 endif | |
496 syn match pandocListItemBullet /^(\?.\{-}[.)]/ contained containedin=pandocListItem | |
497 syn match pandocListItemBulletId /\(\d\+\|\l\|\#\|@.\{-}\|x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}\)/ contained containedin=pandocListItemBullet | |
498 | |
499 syn match pandocListItemContinuation /^\s\+\([-+*]\s\+\|(\?.\+[).]\)\@<!\([[:upper:][:lower:]_"[]\|\*\S\)\@=.*$/ nextgroup=pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation,pandocListItem contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocReferenceURL,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape contained skipempty display | |
500 " }}}2 | |
501 | |
502 " Definitions: {{{2 | |
503 if g:pandoc#syntax#use_definition_lists == 1 | |
504 syn region pandocDefinitionBlock start=/^\%(\_^\s*\([`~]\)\1\{2,}\)\@!.*\n\(^\s*\n\)\=\s\{0,2}\([:~]\)\(\3\{2,}\3*\)\@!/ skip=/\n\n\zs\s/ end=/\n\n/ contains=pandocDefinitionBlockMark,pandocDefinitionBlockTerm,pandocCodeBlockInsideIndent,pandocEmphasis,pandocStrong,pandocStrongEmphasis,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocFootnoteID,pandocReferenceURL,pandocReferenceLabel,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocEmDash,pandocEnDash,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID | |
505 syn match pandocDefinitionBlockTerm /^.*\n\(^\s*\n\)\=\(\s*[:~]\)\@=/ contained contains=pandocNoFormatted,pandocEmphasis,pandocStrong,pandocLaTeXInlineMath,pandocEscapedDollar,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID nextgroup=pandocDefinitionBlockMark | |
506 call s:WithConceal('definition', 'syn match pandocDefinitionBlockMark /^\s*[:~]/ contained', 'conceal cchar='.s:cchars['definition']) | |
507 endif | |
508 " }}}2 | |
509 | |
510 " Special: {{{2 | |
511 | |
512 " New_lines: {{{3 | |
513 if g:pandoc#syntax#newlines == 1 | |
514 call s:WithConceal('newline', 'syn match pandocNewLine /\%(\%(\S\)\@<= \{2,}\|\\\)$/ display containedin=pandocEmphasis,pandocStrong,pandocStrongEmphasis,pandocStrongInEmphasis,pandocEmphasisInStrong', 'conceal cchar='.s:cchars['newline']) | |
515 endif | |
516 " }}}3 | |
517 | |
518 " Emdashes: {{{3 | |
519 if &encoding ==# 'utf-8' | |
520 call s:WithConceal('emdashes', 'syn match pandocEllipses /\([^-]\)\@<=---\([^-]\)\@=/ display', 'conceal cchar=—') | |
521 endif | |
522 " }}}3 | |
523 | |
524 " Endashes: {{{3 | |
525 if &encoding ==# 'utf-8' | |
526 call s:WithConceal('endashes', 'syn match pandocEllipses /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=–') | |
527 endif | |
528 " }}}3 | |
529 | |
530 " Ellipses: {{{3 | |
531 if &encoding ==# 'utf-8' | |
532 call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ display', 'conceal cchar=…') | |
533 endif | |
534 " }}}3 | |
535 | |
536 " Quotes: {{{3 | |
537 if &encoding ==# 'utf-8' | |
538 call s:WithConceal('quotes', 'syn match pandocBeginQuote /"\</ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar='.s:cchars['quote_s']) | |
539 call s:WithConceal('quotes', 'syn match pandocEndQuote /\(\>[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar='.s:cchars['quote_e']) | |
540 endif | |
541 " }}}3 | |
542 | |
543 " Hrule: {{{3 | |
544 syn match pandocHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display | |
545 " }}}3 | |
546 | |
547 " Backslashes: {{{3 | |
548 if g:pandoc#syntax#conceal#backslash == 1 | |
549 syn match pandocBackslash /\v\\@<!\\((re)?newcommand)@!/ containedin=ALLBUT,pandocCodeblock,pandocCodeBlockInsideIndent,pandocNoFormatted,pandocNoFormattedInEmphasis,pandocNoFormattedInStrong,pandocDelimitedCodeBlock,pandocLineBlock,pandocYAMLHeader conceal | |
550 endif | |
551 " }}}3 | |
552 | |
553 " &-escaped Special Characters: {{{3 | |
554 syn match pandocAmpersandEscape /\v\&(#\d+|#x\x+|[[:alnum:]]+)\;/ contains=NoSpell | |
555 " }}}3 | |
556 | |
557 " YAML: {{{2 | |
558 try | |
559 unlet! b:current_syntax | |
560 syn include @YAML syntax/yaml.vim | |
561 catch /E484/ | |
562 endtry | |
563 syn region pandocYAMLHeader start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=@YAML containedin=TOP | |
564 " }}}2 | |
565 | |
566 " }}}1 | |
567 | |
568 " Styling: {{{1 | |
569 function! s:SetupPandocHighlights() | |
570 | |
571 hi def link pandocOperator Operator | |
572 | |
573 " override this for consistency | |
574 hi pandocTitleBlock term=italic gui=italic | |
575 hi def link pandocTitleBlockTitle Directory | |
576 hi def link pandocAtxHeader Title | |
577 hi def link pandocAtxStart Operator | |
578 hi def link pandocSetexHeader Title | |
579 hi def link pandocHeaderAttr Comment | |
580 hi def link pandocHeaderID Identifier | |
581 | |
582 hi def link pandocLaTexSectionCmd texSection | |
583 hi def link pandocLaTeXDelimiter texDelimiter | |
584 | |
585 hi def link pandocHTMLComment Comment | |
586 hi def link pandocHTMLCommentStart Delimiter | |
587 hi def link pandocHTMLCommentEnd Delimiter | |
588 hi def link pandocBlockQuote Comment | |
589 hi def link pandocBlockQuoteMark Comment | |
590 hi def link pandocAmpersandEscape Special | |
591 | |
592 " if the user sets g:pandoc#syntax#codeblocks#ignore to contain | |
593 " a codeblock type, don't highlight it so that it remains Normal | |
594 if index(g:pandoc#syntax#codeblocks#ignore, 'definition') == -1 | |
595 hi def link pandocCodeBlockInsideIndent String | |
596 endif | |
597 | |
598 if index(g:pandoc#syntax#codeblocks#ignore, 'delimited') == -1 | |
599 hi def link pandocDelimitedCodeBlock Special | |
600 endif | |
601 | |
602 hi def link pandocDelimitedCodeBlockStart Delimiter | |
603 hi def link pandocDelimitedCodeBlockEnd Delimiter | |
604 hi def link pandocDelimitedCodeBlockLanguage Comment | |
605 hi def link pandocBlockQuoteinDelimitedCodeBlock pandocBlockQuote | |
606 hi def link pandocCodePre String | |
607 | |
608 hi def link pandocLineBlockDelimiter Delimiter | |
609 | |
610 hi def link pandocListItemBullet Operator | |
611 hi def link pandocUListItemBullet Operator | |
612 hi def link pandocListItemBulletId Identifier | |
613 | |
614 hi def link pandocReferenceLabel Label | |
615 hi def link pandocReferenceURL Underlined | |
616 hi def link pandocLinkTip Identifier | |
617 hi def link pandocImageIcon Operator | |
618 | |
619 hi def link pandocReferenceDefinition Operator | |
620 hi def link pandocReferenceDefinitionLabel Label | |
621 hi def link pandocReferenceDefinitionAddress Underlined | |
622 hi def link pandocReferenceDefinitionTip Identifier | |
623 | |
624 hi def link pandocAutomaticLink Underlined | |
625 | |
626 hi def link pandocDefinitionBlockTerm Identifier | |
627 hi def link pandocDefinitionBlockMark Operator | |
628 | |
629 hi def link pandocSimpleTableDelims Delimiter | |
630 hi def link pandocSimpleTableHeader pandocStrong | |
631 hi def link pandocTableMultilineHeader pandocStrong | |
632 hi def link pandocTableDelims Delimiter | |
633 hi def link pandocGridTableDelims Delimiter | |
634 hi def link pandocGridTableHeader Delimiter | |
635 hi def link pandocPipeTableDelims Delimiter | |
636 hi def link pandocPipeTableHeader Delimiter | |
637 hi def link pandocTableHeaderWord pandocStrong | |
638 | |
639 hi def link pandocAbbreviationHead Type | |
640 hi def link pandocAbbreviation Label | |
641 hi def link pandocAbbreviationTail Type | |
642 hi def link pandocAbbreviationSeparator Identifier | |
643 hi def link pandocAbbreviationDefinition Comment | |
644 | |
645 hi def link pandocFootnoteID Label | |
646 hi def link pandocFootnoteIDHead Type | |
647 hi def link pandocFootnoteIDTail Type | |
648 hi def link pandocFootnoteDef Comment | |
649 hi def link pandocFootnoteDefHead Type | |
650 hi def link pandocFootnoteDefTail Type | |
651 hi def link pandocFootnoteBlock Comment | |
652 hi def link pandocFootnoteBlockSeparator Operator | |
653 | |
654 hi def link pandocPCite Operator | |
655 hi def link pandocICite Operator | |
656 hi def link pandocCiteKey Label | |
657 hi def link pandocCiteAnchor Operator | |
658 hi def link pandocCiteLocator Operator | |
659 | |
660 if g:pandoc#syntax#style#emphases == 1 | |
661 hi pandocEmphasis gui=italic cterm=italic | |
662 hi pandocStrong gui=bold cterm=bold | |
663 hi pandocStrongEmphasis gui=bold,italic cterm=bold,italic | |
664 hi pandocStrongInEmphasis gui=bold,italic cterm=bold,italic | |
665 hi pandocEmphasisInStrong gui=bold,italic cterm=bold,italic | |
666 if !exists('s:hi_tail') | |
667 let s:fg = '' " Vint can't figure ou these get set dynamically | |
668 let s:bg = '' " so initialize them manually first | |
669 for s:i in ['fg', 'bg'] | |
670 let s:tmp_val = synIDattr(synIDtrans(hlID('String')), s:i) | |
671 let s:tmp_ui = has('gui_running') || (has('termguicolors') && &termguicolors) ? 'gui' : 'cterm' | |
672 if !empty(s:tmp_val) && s:tmp_val != -1 | |
673 exe 'let s:'.s:i . ' = "'.s:tmp_ui.s:i.'='.s:tmp_val.'"' | |
674 else | |
675 exe 'let s:'.s:i . ' = ""' | |
676 endif | |
677 endfor | |
678 let s:hi_tail = ' '.s:fg.' '.s:bg | |
679 endif | |
680 exe 'hi pandocNoFormattedInEmphasis gui=italic cterm=italic'.s:hi_tail | |
681 exe 'hi pandocNoFormattedInStrong gui=bold cterm=bold'.s:hi_tail | |
682 endif | |
683 hi def link pandocNoFormatted String | |
684 hi def link pandocNoFormattedAttrs Comment | |
685 hi def link pandocSubscriptMark Operator | |
686 hi def link pandocSuperscriptMark Operator | |
687 hi def link pandocStrikeoutMark Operator | |
688 if g:pandoc#syntax#style#underline_special == 1 | |
689 hi pandocSubscript gui=underline cterm=underline | |
690 hi pandocSuperscript gui=underline cterm=underline | |
691 hi pandocStrikeout gui=underline cterm=underline | |
692 endif | |
693 hi def link pandocNewLine Error | |
694 hi def link pandocHRule Delimiter | |
695 endfunction | |
696 | |
697 call s:SetupPandocHighlights() | |
698 | |
699 " }}}1 | |
700 | |
701 let b:current_syntax = 'pandoc' | |
702 | |
703 syntax sync clear | |
704 syntax sync minlines=1000 | |
705 | |
706 let &cpo = s:cpo_save | |
707 unlet s:cpo_save | |
708 | |
709 " vim: set fdm=marker foldlevel=0: |