Introducing the HTML_to_Sliml gem

require 'html_to_sliml'

html =<<EOF

<html>
  <head>
    <title color="green" size="3">testing this page</title>
  </head>
  <body>
    <p>Testing something</p>
  </body>
</html>
EOF
h2s = HtmlToSliml.new(html).to_s
puts h2s

Output:

html
  head
    title {color: "green", size: "3"} testing this page
  body
    p Testing something

Resources