diff --git a/lib/outlook/internal_tree/html.ex b/lib/outlook/internal_tree/html.ex
index ab33aaa..888e42d 100644
--- a/lib/outlook/internal_tree/html.ex
+++ b/lib/outlook/internal_tree/html.ex
@@ -3,6 +3,25 @@ defmodule Outlook.InternalTree.Html do
alias Outlook.InternalTree.InternalNode
alias Outlook.InternalTree.TranslationUnit
+ @desirable_atts %{"a" => [:href], "img" => [:src]}
+
+ def strip_attributes([%InternalNode{type: :element} = node | rest]) do
+ d_atts = Map.get(@desirable_atts, node.name, [])
+ atts = Map.reject(node.attributes, fn {k,_} -> k not in d_atts end)
+ [ %{node |
+ attributes: atts,
+ content: strip_attributes(node.content)
+ }
+ | strip_attributes(rest) ]
+ end
+
+ def strip_attributes([node | rest]) do
+ [ node | strip_attributes(rest)]
+ end
+
+ def strip_attributes([]), do: []
+
+
def to_html([ %InternalNode{type: :element} = node | rest]) do
attr_string = Map.put(node.attributes, :uuid, node.uuid)
|> Enum.map_join(" ", fn {k,v} -> "#{k}=\"#{v}\"" end)