anchor.diff:      end.
   
   doc_contents_(_XPath, Doc, Opts) ->
  -    Equiv = xpath_to_chunk("./equiv", Doc),
  -    Desc = xpath_to_chunk("./description/fullDescription", Doc),
  -    See = xpath_to_chunk("./see", Doc),
  +    Equiv = xpath_to_chunk("./equiv", Doc, Opts),
  +    Desc = xpath_to_chunk("./description/fullDescription", Doc, Opts),
  +    See = xpath_to_chunk("./see", Doc, Opts),
       doc_content(Equiv ++ Desc ++ See, Opts).
   
   meta_deprecated(Doc, Opts) ->
  
positive.code: xpath_to_integer(XPath, Doc, Opts) ->
      binary_to_integer(xpath_to_text(XPath, Doc, Opts)).
  
  xpath_to_chunk(XPath, Doc) ->
      XmerlDoc = xmerl_xpath:string(XPath, Doc),
      xmerl_to_chunk(XmerlDoc).
  
  %%.
  %%' Xmerl to chunk format
  %%
  
  -spec xmerl_to_chunk([xmerl_doc_node()]) -> shell_docs:chunk_elements().
  xmerl_to_chunk(Contents) ->
      shell_docs:normalize(format_content(Contents)).
  
  -spec format_content([xmerl_doc_node()]) -> shell_docs:chunk_elements().
  format_content(Contents) ->
      {SeeTags, OtherTags} = lists:partition(fun (#xmlElement{name = see}) -> true;
  					       (_) -> false end,
  					   Contents),
      lists:flatten([ format_content_(T) || T <- OtherTags ] ++ rewrite_see_tags(SeeTags)).
  
  -spec format_content_(xmerl_doc_node()) -> shell_docs:chunk_elements().
  format_content_(#xmlPI{})      -> [];
  format_content_(#xmlComment{}) -> [];
  
  format_content_(#xmlText{} = T) ->
      Text = T#xmlText.value,
      case edoc_lib:is_space(Text) of
  	true -> [];
  	false -> [unicode:characters_to_binary(Text)]
      end;
  
  format_content_(#xmlElement{name = equiv} = E) ->
      format_element(rewrite_equiv_tag(E));
  format_content_(#xmlElement{name = a} = E) ->
      format_element(rewrite_a_tag(E));
  format_content_(#xmlElement{} = E) ->
      format_element(E).
  
  format_element(#xmlElement{} = E) ->
      #xmlElement{name = Name, content = Content, attributes = Attributes} = E,
      case {is_edoc_tag(Name), is_html_tag(Name)} of
  	{true, _} ->
  	    format_content(Content);
  	{_, false} ->
  	    edoc_report:warning("'~s' is not allowed - skipping tag, extracting content", [Name]),
  	    format_content(Content);
  	_ ->
  	    [{Name, format_attributes(Attributes), format_content(Content)}]
      end.
  
  -spec format_attributes([xmerl_attribute()]) -> [shell_docs:chunk_element_attr()].
  
negative.code:     SimpleE = xmerl_lib:simplify_element(E),
      xmerl_lib:normalize_element(rewrite_docgen_link(SimpleE)).
  
  rewrite_see_tags([], _Opts) -> [];
  rewrite_see_tags([#xmlElement{name = see} | _] = SeeTags, Opts) ->
      Grouped = [ rewrite_see_tag(T) || T <- SeeTags ],
      NewXML = {p, [], [{em,[],["See also: "]}] ++ lists:join(", ", Grouped) ++ ["."]},
      %% Convert strings to binaries in the entire new tree:
      [format_content_(xmerl_lib:normalize_element(NewXML), Opts)].
  
  rewrite_see_tag(#xmlElement{name = see} = E) ->
      %% TODO: this is not formatted nicely by shell_docs...
  