code: def _preprocess_refs(self, section):
      
      def handler(match):
        mod = match.group('mod')
        ref = match.group('ref')
        parens = match.group('parens') or ''
        dup = match.group('dup')
        has_trailing_dot = False
        if not parens and ref.endswith('.'):
          ref = ref[:-1]
          has_trailing_dot = True
  
        if '#' in ref:
          text = ref.split('#')[-1]
          title = mod_ref = ref.replace('#', '.')
          anchor = text.lower()
        else:
          title = text = anchor = ref
          anchor = ref.replace('.', '')
          mod_ref = ref
  
        if self.config['headers'] == 'html':
            anchor = mod_ref
            if not mod and not anchor.startswith(section.identifier):
                anchor = section.identifier + '.' + anchor
        elif dup:
            anchor += '_' + dup[1:]
  
        result = '`{}`'.format(text + parens)
        link = self.link_lookup.get(mod_ref, self.link_lookup.get(ref))
        if mod and link:
          result = ('[' + result + '](' + link + '#' + anchor + ' "' + title + '")')
        else:
          result = '[' + result + '](#' + anchor + ')'
        if has_trailing_dot:
          result += '.'
        return (match.group('prefix') or '') + result
      return re.sub('(?P<prefix>^| |\t)#(?P<mod>::)?(?P<ref>[\w\d\._\#]+)(?P<parens>\(\))?(?P<dup>\+\d+)?', handler, section.content)
docs: Parses references and replaces them with markdown links
      Syntax is:
          `#anchor` for in page reference
          `#::mod[.submod][#item][+n]` where
              `mod.submod` is the module, `item` is the module member and n is
              the number of duplicates in case of headers: markdown conflicts.
              You can also references class members: `#::mod.submod.cls#method`