scinfu / SwiftSoup

SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
https://scinfu.github.io/SwiftSoup/
MIT License
4.52k stars 345 forks source link

How to convert finished html to html inline styled fragment #248

Closed rhwoodpecker closed 1 month ago

rhwoodpecker commented 1 year ago

like:

  <html> 
     <style>p { width: 20px;} </style>
     <body>
        <p>hhhh</p>
     </body>
  </html>

got: <p style="width: 20px">hhh</p>

kinee1 commented 5 months ago

To convert a finished HTML document with external CSS styles into an HTML fragment with inline styles applied directly to the elements, you'll need to:

Extract the CSS styles from the