I am trying to use the Icomoon icon font with Haml and can\'t seem to find a way to escape the &
so that it stays just an &
instead of
You can use the :escape_attrs option to control whether HTML sensitive characters in attributes are escaped:
require 'haml'
haml = "%a(href='/posts' data-icon=\"&\" aria-hidden='true')"
puts Haml::Engine.new(haml, :escape_attrs => false).to_html
Output:
Note that this will apply to all attributes in your Haml template.