Open fenuks opened 10 months ago
This patch seems to fix the issue without adverse effects:
diff --git i/syntax/pandoc.vim w/syntax/pandoc.vim
index 38df7f1..9cdd83f 100644
--- i/syntax/pandoc.vim
+++ w/syntax/pandoc.vim
@@ -400,7 +400,7 @@ call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained
" }}}2
" Headers: {{{2
-syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display
+syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\|^#\{1,6}.*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display
syn match pandocAtxHeaderMark /\(^#\{1,6}\|\\\@<!#\+\(\s*.*$\)\@=\)/ contained containedin=pandocAtxHeader
call s:WithConceal('atx', 'syn match pandocAtxStart /#/ contained containedin=pandocAtxHeaderMark', 'conceal cchar='.s:cchars['atx'])
syn match pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape
Here is a cleaner workaround before this patch can be merged to the upstream. Add these to vimrc:
augroup consecutive_heading
au!
au filetype pandoc syn clear pandocAtxHeader
au filetype pandoc syn match pandocAtxHeader /\(\%^\|<.\+>.*\|^\s*\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display
augroup END
Hello, for file
vim-pandoc-syntax conceals it to .
This problem was introduced in https://github.com/vim-pandoc/vim-pandoc-syntax/commit/634d830b0f73fea73526d4ea294cb3f33a4e79ef. That change fixes incorrect detection of headers in the middle of paragraphs, but is a bit too strict.