HtmlFlow icon indicating copy to clipboard operation
HtmlFlow copied to clipboard

How to embed svg

Open DaHaiz opened this issue 8 months ago • 1 comments

Hi all,

first of all: HtmlFlow is exactly what I ever wanted as templating for kotlin! Thx for giving this to the community.

While trying it out on a few examples i stumbled upon an SVG icon, which is included as an svg tag. Unfortunately, HtmlFlow does not yet support g or path elements inside svgelements.

How do we specifiy the contents of an SVG?

Thx in advance!

DaHaiz avatar Jun 11 '25 09:06 DaHaiz

Hi,

Glad to hear you're enjoying HtmlFlow!

The HtmlFlow API is automatically generated from the HTML 5.2 XSD using our xsd2poet engine. You can find the current XSD resource here: 👉 https://github.com/xmlet/xsd2poet/blob/main/src/main/resources/html_5_2.xsd

Currently, it doesn’t include the full SVG specification — that’s why some SVG-related methods are missing in HtmlFlow. If we can get a complete and reliable SVG XSD, we’d be happy to extend our API accordingly.

In the meantime, you can work around this limitation using the raw() builder method, which lets you insert arbitrary text or markup inside elements like <svg>. That might help resolve your issue for now.

By the way, just out of curiosity — what motivated you to choose HtmlFlow for web templating in Kotlin over something like kotlinx.html? I'd like to hear your perspective.

Best regards, Miguel

fmcarvalho avatar Jun 11 '25 15:06 fmcarvalho