anchor.diff:  
   %% @spec to_tokens(html_node()) -> [html_token()]
   %% @doc Convert a html_node() tree to a list of tokens.
  +to_tokens({Tag0}) ->
  +    to_tokens({Tag0, [], []});
  +to_tokens(T={'=', _}) ->
  +    [T];
  +to_tokens(T={doctype, _}) ->
  +    [T];
  +to_tokens(T={comment, _}) ->
  +    [T];
  +to_tokens({Tag0, Acc}) ->
  +    to_tokens({Tag0, [], Acc});
   to_tokens({Tag0, Attrs, Acc}) ->
       Tag = to_tag(Tag0),
       to_tokens([{Tag, Acc}], [{start_tag, Tag, Attrs, is_singleton(Tag)}]).
   
   %% @spec to_html([html_token()] | html_node()) -> iolist()
   %% @doc Convert a list of html_token() to a HTML document.
  -to_html(Node={_Tag, _Attrs, _Acc}) ->
  +to_html(Node) when is_tuple(Node) ->
       to_html(to_tokens(Node));
   to_html(Tokens) when is_list(Tokens) ->
       to_html(Tokens, []).
  
positive.code: to_html([{end_tag, Tag} | Rest], Acc) ->
      to_html(Rest, [["</" ++ Tag, ">"] | Acc]).
  
  attrs_to_html([], Acc) ->
      lists:reverse(Acc);
  attrs_to_html([{K, V} | Rest], Acc) ->
  
negative.code: %% Internal API
  
  test_to_html() ->
      Expect = <<"<html><head><title>hey!</title></head><body><p class=\"foo\">what's up<br /></p><div>sucka</div><!-- comment! --></body></html>">>,
      Expect = iolist_to_binary(
                 to_html({html, [],
                          [{"head", [],
                            [{title, "hey!"}]},
                           {body, [],
                            [{p, [{class, foo}], ["what's", <<" up">>, {br}]},
                             {'div', <<"sucka">>},
                             {comment, " comment! "}]}]})),
      Expect1 = <<"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">">>,
      Expect1 = iolist_to_binary(
                  to_html({doctype,
                           ["html", "PUBLIC",
                            "-//W3C//DTD XHTML 1.0 Transitional//EN",
                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]})),
      ok.
  to_html([], Acc) ->
      lists:reverse(Acc);
  to_html([{'=', Content} | Rest], Acc) ->
      to_html(Rest, [Content | Acc]);
  to_html([{comment, Comment} | Rest], Acc) ->
      to_html(Rest, [["<!--" ++ Comment, "-->"] | Acc]);
  to_html([{doctype, Parts} | Rest], Acc) ->
      Inside = doctype_to_html(Parts, Acc),
      to_html(Rest, [["<!DOCTYPE" ++ Inside, ">"] | Acc]);
  to_html([{data, Data, _Whitespace} | Rest], Acc) ->
      to_html(Rest, [escape(Data) | Acc]);
  to_html([{start_tag, Tag, Attrs, Singleton} | Rest], Acc) ->
  