   end
 
   defp build_raw_html([], html, _encoder), do: html
-  defp build_raw_html(string, _html, encoder) when is_binary(string), do: encoder.(string)
+  defp build_raw_html(string, _html, encoder) when is_binary(string),
+    do: html_escape_text(encoder.(string))
 
   defp build_raw_html(tuple, html, encoder) when is_tuple(tuple),
     do: build_raw_html([tuple], html, encoder)

      & &1
    end
  end
end

  end

  defp build_attrs({attr, <<value::binary>>}, attrs) do
    "#{attrs} #{attr}=\"#{html_escape_attribute_value(value)}\""
  end

  defp build_attrs(<<attr::binary>>, attrs), do: "#{attrs} #{attr}"
