preservim / vim-markdown

Markdown Vim Mode
4.69k stars 524 forks source link

Underline underlined text instead of making it italic #591

Closed gvfarns closed 2 years ago

gvfarns commented 2 years ago

At present, this plugin marks text that is surrounded by underscores as italic and highlights it with htmlItalic. Why not underline it instead?

Something like

syn region mkdUnderline matchgroup=mkdUnderline start="\%(_\)"    end="\%(_\)"
execute 'syn region htmlUnderline matchgroup=mkdUnderline start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend contains=@Spell' . s:oneline . s:concealends

and

hi htmlUnderline cterm=underline
alerque commented 2 years ago

Markdown underscores are used for emphasis. They are not semantically different from asterisks used for the same purpose, they are just at alternative syntax. In conversion to most output formats like HTML or Tex this is rendered as italic, hence that's an appropriate default here to. There is no markup in Markdown for underline styling, you would need to use a class like my [underline]{.underline} text.

That being said output styling is not actually up to this plugin at all. The VIM color scheme is actually responsible for the final styling choices. As such you can use a color scheme that uses underlines instead of italics or modify yours to do this.