Skip to content

Commit 4e1f4de

Browse files
committed
Merge pull request #125 from lyokha/master
correct highlights of hrules and YAML headers
2 parents 7c231cc + 5aa28f5 commit 4e1f4de

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

syntax/pandoc.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,24 +333,24 @@ syn match pandocLineBlockDelimiter /^|/ contained containedin=pandocLineBlock
333333

334334
" Simple: {{{3
335335

336-
syn region pandocSimpleTable start=/\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)\(-\+\s*\)\+\n\n\@!/ end=/\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock keepend
336+
syn region pandocSimpleTable start=/\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)\(-\+\s*\)\+\n\n\@!/ end=/\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
337337
syn match pandocSimpleTableDelims /\-/ contained containedin=pandocSimpleTable
338338
syn match pandocSimpleTableHeader /\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)/ contained containedin=pandocSimpleTable
339339

340-
syn region pandocTable start=/\%#=2^\(-\+\s*\)\+\n\n\@!/ end=/\%#=2^\(-\+\s*\)\+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock keepend
340+
syn region pandocTable start=/\%#=2^\(-\+\s*\)\+\n\n\@!/ end=/\%#=2^\(-\+\s*\)\+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
341341
syn match pandocTableDelims /\-/ contained containedin=pandocTable
342342
syn region pandocTableMultilineHeader start=/\%#=2\(^-\+\n\)\@<=./ end=/\%#=2\n-\@=/ contained containedin=pandocTable
343343

344344
" }}}3
345345
" Grid: {{{3
346-
syn region pandocGridTable start=/\%#=2\n\@1<=+-/ end=/+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock keepend
346+
syn region pandocGridTable start=/\%#=2\n\@1<=+-/ end=/+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
347347
syn match pandocGridTableDelims /[\|=]/ contained containedin=pandocGridTable
348348
syn match pandocGridTableDelims /\%#=2\([\-+][\-+=]\@=\|[\-+=]\@1<=[\-+]\)/ contained containedin=pandocGridTable
349349
syn match pandocGridTableHeader /\%#=2\(^.*\n\)\(+=.*\)\@=/ contained containedin=pandocGridTable
350350
"}}}3
351351
" Pipe: {{{3
352352
" with beginning and end pipes
353-
syn region pandocPipeTable start=/\%#=2\([+|]\n\)\@<!\n\@1<=|\(.*|\)\@=/ end=/|.*\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock keepend
353+
syn region pandocPipeTable start=/\%#=2\([+|]\n\)\@<!\n\@1<=|\(.*|\)\@=/ end=/|.*\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
354354
" without beginning and end pipes
355355
syn region pandocPipeTable start=/\%#=2^.*\n-.\{-}|/ end=/|.*\n\n/ keepend
356356
syn match pandocPipeTableDelims /[\|\-:+]/ contained containedin=pandocPipeTable
@@ -445,21 +445,21 @@ if &encoding == "utf-8"
445445
call s:WithConceal("quotes", 'syn match pandocEndQuote /\(\>[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=”')
446446
endif
447447
" Hrule: {{{3
448-
syn match pandocHRule /\*\{3}$/ display
448+
syn match pandocHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display
449449
" Backslashes: {{{3
450450
if g:pandoc#syntax#conceal#backslash == 1
451-
syn match pandocBackslash /\\\@<!\\/ containedin=ALLBUT,pandocCodeblock,pandocCodeBlockInsideIndent,pandocNoFormatted,pandocNoFormattedInEmphasis,pandocNoFormattedInStrong,pandocDelimitedCodeBlock,pandocLineBlock conceal
451+
syn match pandocBackslash /\\\@<!\\/ containedin=ALLBUT,pandocCodeblock,pandocCodeBlockInsideIndent,pandocNoFormatted,pandocNoFormattedInEmphasis,pandocNoFormattedInStrong,pandocDelimitedCodeBlock,pandocLineBlock,pandocYAMLHeader conceal
452452
endif
453453
" }}}
454454
" }}}
455455
" YAML: {{{2
456456

457457
try
458458
unlet! b:current_syntax
459-
syn include @YAML colors/yaml.vim
459+
syn include @YAML syntax/yaml.vim
460460
catch /E484/
461461
endtry
462-
syn region pandocYAMLHeader matchgroup=Delimiter start=/\(\%^\|\(\s*.*\n\)\)\@<=\-\{3}\s*$/ end=/[\-|\.]\{3}\s*$/ contains=@YAML containedin=TOP
462+
syn region pandocYAMLHeader start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=@YAML containedin=TOP
463463
"}}}
464464
"}}}1
465465

0 commit comments

Comments
 (0)