3

Support for converting style attributes to HTML attributes · Issue #138 · Strang...

 2 years ago
source link: https://github.com/Stranger6667/css-inline/issues/138
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

yisibl commented 3 days ago

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
  <path d="M2,2 v6 h6 v-6 h-6 z" style="stroke:#FF0000;stroke-width:0.5;fill:none;"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
  <path d="M2,2 v6 h6 v-6 h-6 z" stroke="#FF0000" stroke-width="0.5" fill="none"/>
</svg>

This is useful for font tools, e.g. googlefonts/picosvg#60

Copy link

Owner

Stranger6667 commented 3 days ago

Hi! Thank you for reporting! :)

Interesting feature - implementation-wise it should be relatively straightforward:

  • Config flag
  • If enabled, then insert collected styles as attributes

Though the underlying library does not provide a way to attach an XML parser / serializer, therefore I am concerned about the use case you provided would not be supported out of the box. However, implementing such a thing is feasible even without kuchiki-rs as there is a standalone XML parser available for Rust.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK