code: function formatAnchor(elem, fn, options) {
    var href = '';
    // Always get the anchor text
    var storedCharCount = options.lineCharCount;
    var text = fn(elem.children || [], options);
    if (!text) {
      text = '';
    }
  
    var result = elem.trimLeadingSpace ? trimStart(text) : text;
  
    if (!options.ignoreHref) {
      // Get the href, if present
      if (elem.attribs && elem.attribs.href) {
        href = elem.attribs.href.replace(/^mailto:/, '');
      }
      if (href) {
        if ((!options.noAnchorUrl) || (options.noAnchorUrl && href[0] !== '#')) {
          if (options.linkHrefBaseUrl && href.indexOf('/') === 0) {
            href = options.linkHrefBaseUrl + href;
          }
          if (!options.hideLinkHrefIfSameAsText || href !== helper.replaceAll(result, '\n', '')) {
            if (!options.noLinkBrackets) {
              result += ' [' + href + ']';
            } else {
              result += ' ' + href;
            }
          }
        }
      }
    }
  
    options.lineCharCount = storedCharCount;
  
    return formatText({ data: result || href, trimLeadingSpace: elem.trimLeadingSpace }, options);
  }
docs: If we have both href and anchor text, format it in a useful manner: - "anchor text [href]" Otherwise if we have only anchor text or an href, we return the part we have: - "anchor text" or - "href"