vim-markdown icon indicating copy to clipboard operation
vim-markdown copied to clipboard

The code block highlighting of vim-markdown does not work properly under vim8's popup-window.

Open flw-cn opened this issue 5 years ago • 0 comments

The code block highlighting of vim-markdown does not work properly under vim8's popup-window.

image

As shown, the same markdown code is rendered differently in a normal buffer than in a popup-window (the latter's C code has no syntax highlighting).

Here's the vimrc I used to test(assuming vim-markdown is installed in the ~/.vim/bundle directory.):

set nocompatible
syntax on
filetype plugin on

set term=xterm
set background=dark
colorscheme desert
hi! link Pmenu Normal

set rtp+=~/.vim/bundle/vim-markdown

autocmd FileType markdown set conceallevel=2

function! Test()
    let lines = getline(1, line('$'))
    let winid = popup_dialog(lines, #{})
    silent! call win_execute(winid, 'setlocal nofoldenable')
    silent! call win_execute(winid, 'setlocal ft=markdown')
endfunction

command Test call Test()

Here's the markdown text I used to test it (which doesn't actually have the \ before ```):

## header

\```C
int main(void) {
    printf("Hello, world!\n");
}
\```

normal **bold**

You can reproduce my results above by using the following command:

vim -u vimrc -U NONE foo.md

then input vim command:

:Test

I'm sure the problem is due to the rendering in popup-window not triggering s:MarkdownRefreshSyntax(1), I've planned to change it but it hasn't worked yet, so I'm hoping for some help.

flw-cn avatar Sep 11 '20 02:09 flw-cn