vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
424 stars 61 forks source link

pandocDelimitedCodeBlock should not requires preceeding or leading empty line #335

Open soraxas opened 4 years ago

soraxas commented 4 years ago

Hi!

Is there a reason why the code block conceal requires an empty line before and after the three backticks at line 439 and 441? https://github.com/vim-pandoc/vim-pandoc-syntax/blob/0d1129e5cf1b0e3a90e923c3b5f40133bf153f7c/syntax/pandoc.vim#L439

The pandocDelimitedCodeBlockStart regex requires two preceding ^ (line 439) and pandocDelimitedCodeBlockEnd requires two leading $ (line 441) which means it needs a blank line before and after.

But as far as I can tell, in markdown the three backticks that begins a block of code can be followed right after text, and the same goes for the ending of code block (can be followed by non-empty lines). They should be valid syntax.

See the following:

Without enabling syntax a

Current behaviour b

After I edited the code, made it only requires one preceding ^ and leading $ for the begin/end of code regex. c

I would expect the third scenario for concealing. Note that highlighting works as expected (as seen by the illustrations), it's only the conceal that doesn't work.