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

Mistook todo checkbox as a markdown link

Open VimWei opened this issue 1 year ago • 0 comments

Environment

I use the built-in markdown plugin with gvim 9.1, without installing any third-party markdown filetype plugins.

  • gvim_9.1.0309_x64_signed.exe
  • Win 10 pro 22H2

Issue reproduction

  1. :new
  2. :set filetype=markdown
  3. Add a space (just one space) and a markdown link after a todo checkbox:

* [x] [test](https://www.example.com)

We can see vim mistook todo checkbox [x] as a markdown link, and the x will be underlined.

image

  • More clear: If I configure augroup MarkdownLinkConceal, the todo checkbox will be concealed as if it were a markdown link. However, the [ ] symbols around test are not concealed.
augroup MarkdownLinkConceal
    autocmd!
    autocmd FileType markdown
        \ syn region markdownLink matchgroup=markdownLinkDelimiter
        \ start="(" end=")" contains=markdownUrl keepend contained conceal
    autocmd FileType markdown
        \ syn region markdownLinkText matchgroup=markdownLinkTextDelimiter
        \ start="!\=\[\%(\_[^][]*\%(\[\_[^][]*\]\_[^][]*\)*]\%( \=[[(]\)\)\@="
        \ end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite
        \ contains=@markdownInline,markdownLineStart concealends
augroup END

image

  • Compare: If there are two or more spaces after todo checkbox, the issue disappear.

* [x] [test](https://www.example.com)

image

image

Reference

  • similar issue: https://github.com/nextcloud/deck/issues/2640

VimWei avatar Apr 19 '24 09:04 VimWei