rehypejs/rehype-minify

minify-whitespace add template tag to callapsable list

StarpTech opened this issue · 3 comments

Input

<h1>
  404
  <template v-if="resource">
    the {{ resource }} was
  </template>
  not found
</h1>

Input

<h1>
  404
  <template v-if="resource">the {{ resource }} was</template>not found
</h1>

This will lead to error 404 the resource wasnotfound because the template tag wasn't identified as a collapsable tag. Due to the fact that we didn't know the context where it is used we should handle it as a collapsable element.

I close it. This is the case isn't valid according to HTML specs but for web frameworks. The template tag is a container of content which isn't parsed at runtime so it depends on how the user will use it.

Hmm, weird!

This is Vue right? Hmm, they’re doing something funky and non-HTML with template tags.
Doesn’t Vue also have fragments? Would a fragment (or a span) in this case make more sense?

Yes, it's vue and in angular the equivalent is ng-container. A span wouldn't be the same since the user doesn't want to create a real an extra node. In my fork I added the elements to the lists because its no huge change and provide better compatibility for web frameworks.