preservim / vim-markdown

Markdown Vim Mode
4.68k stars 521 forks source link

"<" in text causes wrong highlight #304

Open bamoqi opened 7 years ago

bamoqi commented 7 years ago

In text

4 < 5 6
7

"5 6 7" would be highlighted as html, until a ">" is encountered to cancal the hightlight. According to Markdown reference http://daringfireball.net/projects/markdown/syntax#autoescape , we should recognize them as non-HTML. Quote:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write: 4 < 5 Markdown will translate it to: 4 &lt; 5
cossatot commented 7 years ago

This is pretty annoying for me. I use < to mean 'less than' in markdown documents very frequently, and HTML tags very rarely. Knowing how to disable this would be excellent.

memeplex commented 7 years ago

I'm unable to reproduce this. But here is a related problem

* 4
  5 > 6

The > is highlighted as an htmlError. I think that htmlError should be disabled by default, since it's wrong being picky about html when the main syntax is markdown.

jakobkogler commented 6 years ago

Here's another example, which is pretty annoying for me:

$1 < 2$
Here's some text.

Everything after ' is colored, because vim-markdown thinks this is some kind of string.

yangwenbo99 commented 5 years ago

Similar problem again. This is possibly due to the highlight scheme for HTML installed with my vim. One possible solution is to use a customer highlight scheme for HTML and remove the group htmlTag.

Excerpt from vim's highlight file (Archlinux).

syn region  htmlTag                start=+<[^/]+   end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster

Screenshot from 2019-03-17 11-55-57

tpo commented 5 years ago

Duplicate of #138