vim-markdown
vim-markdown copied to clipboard
Don't assign HTML groups to Markdown syntax
Currently, the syntax file defines elements such as Markdown headers, as well as bold and italic text as HTML elements. While Markdown can be mixed with HTML, or be a precursor to it, it makes little semantic sense to define it as HTML.
When defining a color scheme, this creates a conflict in that giving Markdown some color (most themes/editors do) causes HTML to be overly colorful. Headings in HTML, more specifically the innerHTML between e.g. <h1></h1>
tags are not special among their surroundings (maybe in 1995), so you'll rarely find them highlighted in color schemes. Markdown headings on the other hand carry a lot of weight within the document.
Sensible: Headings define important sections, and emphasized spans tend to be rare within flowing text.
Excessive: Neither headings, nor emphasized spans tend to be colored (maybe made bold/italic) in most themes. They are not more important than the myriad of other elements.
The default Markdown syntax file that ships with vim solves this elegantly by defining such elements as markdownH1-6
, markdownBold
, markdownItalic
and then linking them to their HTML counterparts. This way, one can have a unified HTML/Markdown style, but decoupling HTML is equally possible.
Since this shouldn't break exists themes (the Markdown → HTML mapping remains default), I'd love vim-markdown to adopt the default vim approach.
Related: https://github.com/plasticboy/vim-markdown/issues/471, https://github.com/plasticboy/vim-markdown/issues/461, https://github.com/plasticboy/vim-markdown/issues/388
p.s. I'd have filed a PR myself, but I'm not familiar with vim syntax matching rules. A brief test with simple replacement and linking of highlight groups didn't work.
I'd like this as well, it seems that currently when I do _foobar_
:
-
htmlItalic
is applied onfoobar
-
mkdItalic
is applied on the delimiters_
I'd expect to only have to configure mkdItalic
to change _foobar_
.
Specific rules could be applied to the delimiters _
with a mkdItalicDelimiters
highlight group which would default to mkdItalic
, unless conceal is enabled for example.
I have a ftplugin/markdown.vim
and a ftplugin/html.vim
. And after installing this plugin my html
bindings are overwriting my markdown
bindings.