panoply/esthetic

Support SVG Voids

panoply opened this issue · 2 comments

Description

This one is actually supported in the first minor release of markdown and liquid as thus this issue is merely here for prosperity reasons. Containing SVG tags accept both void and block type token expressions. This means that the following are valid:

<svg>
  <path d="xxxx"></path>
</svg>

<!-- OR -->

<svg>
  <path d="xxxx" />
</svg>

<!-- OR -->

<svg>
  <path d="xxxx">
</svg>

Handling of these structures would fail in the beta versions but support is now available and also an accompanying rule. The new rule and handling will gracefully work these structures and give you the option to convert or omit enders.

New Rule selfClosingSVG

The new markup will determine the existing structures and can remove enders, for example when the rule is enabled which it is by default this:

<svg>
  <path d="xxxx"></path>
</svg>

Will be converted to:

<svg>
  <path d="xxxx" />
</svg>

Partially complete here, though I suspect some minor defects occurring with complex use cases.

Tests

https://github.com/panoply/esthetic/blob/next/tests/cases/html/svg-structures.test.mjs

Supported in v0.6.1-beta.1

Will likely expand upon this in later releases pending stress tests.