SidOfc / mkdx

A vim plugin that adds some nice extra's for working with markdown documents

Home Page:https://www.vim.org/scripts/script.php?script_id=5620

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All text during a link creation is concealled

m-fonseca opened this issue Β· comments

One more for you πŸ˜…

OS type:

  • Unix
  • Windows
  • Other ([SPECIFY])

Vim:

  • vim
  • neovim
  • Other ([SPECIFY])

Vim version:
NVIM v0.5.0-dev+1211-g6db3ba9df

Using mkdx 186cf8c

Reproduce steps:

set conceallevel=2

Edit a markdown file. Insert a link. [test](

Expected:

No problem inserting link.

Actual:
All text is concealed after link while the ( is unclosed. If you don't realize whats happening, it looks like all text is deleted.

Thanks!

Hey @m-fonseca, no problem, I just tried to reproduce this with an empty markdown file by doing the following:

  • Execute :set conceallevel=2 while editing an empty markdown file
  • Press i to go into insert mode and type [test](

However using my configuration nothing gets hidden, can you try this with mkdx in isolation (e.g. as only loaded plugin)?

Ah I see now, to reproduce the markdown file needs to contain some text after the link which will indeed be hidden immediately, oke will check this out.

Ok so I have no clue how to prevent this behavior through syntax highlighting, mkdx just redefines a highlight group from tpope's vim-markdown plugin and adds conceal to it.

The issue can be avoided by using mkdx's PREFIXln functionality with your cursor on the link text or with link text selected, this will wrap it with [cursor-word-or-selection](|) where | will be the position of the cursor in insert mode.

Alternatively, I just added an option g:mkdx#settings.links.conceal which can be set to either 1 (default) or 0. Setting it to 0 will disable link concealing done by mkdx (all other concealing will still happen).

I did actually try one more thing after having typed the above, which is to add oneline to the syntax highlighting group:

syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" keepend contained conceal oneline contains=markdownUrl

However I'm not sure what the implications are / should be for hiding multi-line links, because this only hides links spanning one line which might not always be the case, for this reason I will not be adding it to mkdx.

Thank you. Appreciate you looking into it!

No problem @m-fonseca, if you find a better solution feel free to let me know, in which case I might be able to implement it as an improvement to mkdx.

Also forgot to mention this, but cheers for all the feedback as well, have a good one πŸ‘