vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
424 stars 61 forks source link

Support multiline embedded HTML tags #350

Closed BertrandSim closed 3 years ago

BertrandSim commented 3 years ago

As far as I know HTML tags spanning multiple lines are valid. For example,

<div class="averylongclass"
id="averylongid">
  foo
</div>

is valid HTML. Currently, only single line HTML tags are highlighted, while multiline tags are not. This PR highlights embedded multiline tags.

alerque commented 3 years ago

Does this mess with highlighting Markdown inside HTML wrapper tags? It's not uncommon for Markdown documents to do things like wrap whole sections in some HTML tag. The syntax highlighting should catch the start and end tags as HTML but everything in between as more Markdown. I suspect this patch will break that usage, no?

BertrandSim commented 3 years ago

By wrapper tags, are you referring to something like this?

<section>
## title of section

The following is a list
* item one
* item two
</section>

The highlighting for the above still works as intended. (ie, HTML for <section>, markdown highlighting for the text in between, and HTML highlighting for </section>)

alerque commented 3 years ago

Yes that's the sort of thing I was thinking about.

BertrandSim commented 3 years ago

Yes, this patch does not break that. Here are some screenshots to illustrate :)

image

image

The syntax highlighting captures the opening and closing <section ...> and </section> parts separately.