vim-pandoc / vim-pandoc-legacy

[UNSUPPORTED/use vim-pandoc/vim-pandoc] vim bundle for pandoc users
143 stars 23 forks source link

Incorrect folding when code with comments is present #78

Closed xaviershay closed 10 years ago

xaviershay commented 11 years ago

pandoc#MarkdownLevel() detects the comment in the following snippet as a level one header, which is incorrect:

~~~ {.ruby}
# Some ruby code
~~~

Since I always use ======= syntax for level one headers, I have "fixed" this issue by commenting out the following lines in autoload/pandoc.vim:

function! pandoc#MarkdownLevel()
"    if getline(v:lnum) =~ '^# .*$'
"        return ">1"
"    endif
    if getline(v:lnum) =~ '^## .*$'
        return ">2"
    endif
" .... snip
dsanson commented 11 years ago

Good tip. I suspect there is no easy solution here for those using ATX headers that isn't too resource intensive---like keeping track of whether or not something that looks like an ATX header is embedded in a code block.