vim-markdown
vim-markdown copied to clipboard
Plain less than (<) in list will disable syntax highlighting from that point onwards
After putting a < sign in a list, text after that sign are not highlighted.
**highlighted**
- **highlighted**
- < **not highlighted**
**not highlighted**
**not highlighted**
Thanks for the report: I reproduce, and it is serious as it breaks the syntax of the entire file.
On future posts, please post your markdown code as escaped code on the request so we can see it unredered. I've updated that, and made the example easier to reproduce. Feel free to edit again if you think meaning was lost.
Same problem.
And simply escape the "<" doesn't help.

While this issue still exists, I noticed it works as intended when the < symbol is inside LaTeX math delimiters (e.g., $x < 1$) and vim_markdown_math is enabled.
It looks like the behavior is somehow inherited from the html.vim syntax file: I see the same thing if I do set syntax=html.
See also #104
My solution is to redefine htmlTag. Add following code in your after/syntax/html.vim.
syn clear htmlTag
syn region htmlTag start=+<[[:alnum:]]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
" ^^^^^^^^^^^ redefined this part
Since it's likely to have a space after <, it would work most of the times.
This actually is the correct definition of the html tag according to the specification.
- The first character of a start tag must be a U+003C LESS-THAN SIGN character (<).
- The next few characters of a start tag must be the element's tag name. ...
Tags contain a tag name, giving the element's name. HTML elements all have names that only use ASCII alphanumerics.
Similarly, if you don't want > to be highlighted as htmlError, you can simply clear its definition as well.
@tomtomjhj nice workaround! However it doesn't catch cases like my vim takes <1sec to start. Instead, I'd patch htmlTag to include the oneline argument:
syn clear htmlTag
syn region htmlTag start=+<[^/]+ end=+>+ fold oneline contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster