tpope / vim-markdown

Vim Markdown runtime files
1.22k stars 191 forks source link

Errors when attempting to use markdown as a fenced language #121

Open elazar opened 7 years ago

elazar commented 7 years ago

I'm using Neovim installed via Homebrew.

❯ vim -v
NVIM v0.2.0
Build type: Release
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/config -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/src/nvim/auto -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/include
Compiled by brew@Sierra-2.local

Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.2.0_1/share/nvim"

I have revision a7dbc314569aa85db80c106d73b1664e385b6ae7 of this plugin installed using junegunn/vim-plug@ddc67fc13624dbec62121e0c55ae03f270f66241.

This is the vim configuration file I'm using:

call plug#begin('~/.vim/plugins')

Plug 'tpope/vim-markdown', { 'for': 'markdown' }

let g:markdown_fenced_languages = [
    \ 'markdown',
    \ ]

call plug#end()

If I comment out the block to assign a value to g:markdown_fenced_languages, I'm able to load a .md file without issue. However, with the block in place, loading even an empty .md file produces this output...

"test.md" 0L, 0C
Error detected while processing /usr/local/Cellar/neovim/0.2.0_1/share/nvim/runtime/syntax/javascript.vim:
line    1:
E169: Command too recursive
Error detected while processing /usr/local/Cellar/neovim/0.2.0_1/share/nvim/runtime/syntax/vb.vim:
line    1:
E169: Command too recursive
Error detected while processing /usr/local/Cellar/neovim/0.2.0_1/share/nvim/runtime/syntax/css.vim:
line    1:
E169: Command too recursive
Error detected while processing /Users/matthewturland/.vim/plugins/vim-markdown/syntax/markdown.vim:
line    1:
E169: Command too recursive
Error detected while processing /usr/local/Cellar/neovim/0.2.0_1/share/nvim/runtime/syntax/markdown.vim:
line    1:
E169: Command too recursive
Error detected while processing /Users/matthewturland/.vim/plugins/vim-markdown/syntax/markdown.vim:

... followed by a lot of repetitions of this.

line   31:
E121: Undefined variable: s:done_include
line  105:
E121: Undefined variable: main_syntax
E15: Invalid expression: main_syntax ==# 'markdown'
line  159:
E121: Undefined variable: main_syntax
E15: Invalid expression: main_syntax ==# 'markdown'
austintraver commented 4 years ago

I'm also experiencing this. I can see how adding fenced code blocks with "markdown" syntax highlighting within a markdown file could cause infinite recursion... could this be avoided with some sort of conditional statement?

tpope commented 4 years ago

My guess would be that yes, it could.

AceofSpades5757 commented 3 years ago

Using Vim, I'm having a very similar issue where using markdown as the language is causing a recursive loop.

There could be an issue since I'm pretty sure I just copied the syntax file into my .vim/syntax folder.

File Contents

    # My Markdown File

    ...

    ``` markdown
    Some Markdown...
    ```

Errors

Error detected while processing CursorHold Autocommands for "<buffer=1>"..function <SNR>154_MarkdownRefreshSyntax[2]..<SNR>154_MarkdownHighlightSources[31]..<SNR>154_SyntaxInclude[14]..CursorHold Autocommands for "<buffer=1>"..function <SNR>154_MarkdownRefreshSyntax[2]..<SNR>154_MarkdownHighlightSources[31]..<SNR>154_SyntaxInclude[10]..script C:\Users\USERNAME\vimfiles\syntax\markdown.vim[33]..C:\Program Files\Vim\vim82\syntax\vim.vim:
line  833:
E403: syntax sync: line continuations pattern specified twice
Error detected while processing CursorHold Autocommands for "<buffer=1>"..function <SNR>154_MarkdownRefreshSyntax[2]..<SNR>154_MarkdownHighlightSources:
line   31:
E171: Missing :endif
Error detected while processing CursorHold Autocommands for "<buffer=1>"..function <SNR>154_MarkdownRefreshSyntax:
line    2:
E171: Missing :endif