简体   繁体   中英

vim markdown syntax highlighting is very buggy

I'm not sure which markdown plugin I'm using, but it's not doing a great job of parsing this README.md file.

Here's a visual of what's going on: 在此输入图像描述

Not sure why it's highlighting everything after an underscore, highlights generally mean italic words. It's not very pleasent working in this way. By the way, I've posted the exact code here to demonstrate that the italics are not actually taking place after the underscore.

payment_address
 POST currency string ex: "BTC" amount int ex: 100000 *timeout int ex: 600 *callback JSON object method string ex: "HTTP_POST", "BLOCKCHAIN_WRITE" params JSON object HTTP_POST PARAMS: url string ex: "http://florincoin.info/mucua/callback/ data string ex: see below 

The payment_address api is by far the most

Note: stackoverflow.com doesn't turn #### payment_address into a H3, but it also doesn't make the _address part italic.

  • Is this a bug in vim or am I doing something wrong?
  • How can I find out which vim plugin I'm using to issue a bug report / pull request for a fix?

This is because in markdown underscores mean italics, and that's what Vim is showing. What you are expecting is a Github extension .

You can install this plugin to enable Github Flavored Markdown highlighting.

This is not an exact solution to your syntax highlighting issue but rather a solid way to debug VIM issues. Please don't mark this as the solution to your question.

I would manually go through your ~/.vim/bundles/ folder and mv each plugin out one by one until you find the culprit. Start with the plugins that are likely to be causing the problem and continue from there. Ie, vim-markdown is more likely to be causing these issues than wap-it (my VIM plugin ;) ).

If you still haven't found the culprit after moving all your plugins out, I would then ensure that you're running the latest version of VIM. If THAT doesn't work, I personally would try reinstalling but I'm also not very well versed regarding VIM's internals.

Hope this helps,

The solution I found was to escape underscores in my markdown code. It doesn't make a difference to github whether or not the underscores are escaped, but I suppose for compatibility reasons it's good to escape them anyway (it also solves the problem of incorrectly highlighted text in vim).

Update : This solution doesn't work when underscores are escaped in code spans. Here's an example:

Markdown code:

`HELLO\_WORLD`

Output:

HELLO\\_WORLD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM