-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code highlighting fails in combination with reference link #299
Comments
In general, there seems to be an issue with code highlighting of inline code blocks within links. For example, type the following into a new vim buffer (with <!-- `World` will not be highlighted -->
Hello [`World`]
<!-- `World` will be highlighted just by placing a punctuation mark after the link -->
Hello [`World`]. Note how github's parser (in the example right above) seems to do the right thing. |
I encountered this today. In addition to punctuation marks, a space followed by a left parenthesis, a left bracket, or a backslash will properly highlight the reference link. See screenshot below. This is on call plug#begin()
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
call plug#end() |
Yes there is. IMHO the best solution is probably not to highlight links containing code. If links are implemented as a |
I ran into this issue and started looking into it. It looks like the skip matcher is attempting to handle example 524 and 536 of the commonmark spec, which demonstrates that inline code should take precedent over link definitions. Unfortunately it is not matching properly as it does not account for code which is completely contained within a link text. Here is the breakdown of the skip matcher:
The relevant portion of the regex:
Here is the line where it is used:
I've tried some quick experiments (non-greedy wildcards and adding a negative lookbehind for a second backtick) but these didn't work on my first attempt and I had stop shaving yaks and continue with what I was actually working on. Will try to get a PR for a fix in soon. |
I would mention that, although it is not standards compliant, a workaround that fixed this issue for me in practice, is to delete the skip= part in the pandocReferenceLabel line, i.e., using that line as follows:
Hope that might be of help, while we wait for a proper fix... |
The following example fails to highlight correctly. It seems somehow related to having verbatim text within a code block:
Vim renders it using the latest
vim-pandoc-syntax
like in the image below. As you can see, the first paragraph is entirely highlighted, starting from the link. If I introduce a linebreak before the next code block, it renders correctly.It can also be fixed by inserting the URL inline, i.e. changing
[`some link text`]
to[`some link text`](www.website.com)
. So the problem seems to be also related to reference links.The text was updated successfully, but these errors were encountered: