neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

pandoc.vim (36465B)


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