def process_pending_config_xref_nodes(app, doctree, fromdocname):
    """Process the ``pending_config_xref`` nodes during the ``doctree-resolved``
    event to insert links to the locations of ``lsst-config-topic`` directives.

    See also
    --------
    `config_ref_role`
    `ConfigTopicTargetDirective`
    `pending_config_xref`
    """
    logger = getLogger(__name__)
    env = app.builder.env

    for node in doctree.traverse(pending_config_xref):
        content = []

        # The source of the node is the content the authored entered in the
        # lsst-config role
        role_parts = split_role_content(node.rawsource)
        config_id = format_config_id(role_parts['ref'])
        if role_parts['display']:
            # user's custom display text
            display_text = role_parts['display']
        elif role_parts['last_component']:
            # just the name of the class
            display_text = role_parts['ref'].split('.')[-1]
        else:
            display_text = role_parts['ref']
        link_label = nodes.literal()
        link_label += nodes.Text(display_text, display_text)

        if hasattr(env, 'lsst_task_topics') and \
                config_id in env.lsst_task_topics:
            # A config topic, marked up with the lsst-task directive is
            # available
            config_data = env.lsst_task_topics[config_id]

            ref_node = nodes.reference('', '')
            ref_node['refdocname'] = config_data['docname']
            ref_node['refuri'] = app.builder.get_relative_uri(
                fromdocname, config_data['docname'])
            ref_node['refuri'] += '#' + config_data['target']['refid']

            ref_node += link_label

            content.append(ref_node)

        else:
            # Fallback if the config topic isn't known. Just print the
            # role's formatted content.
            content.append(link_label)

            message = 'lsst-config could not find a reference to %s'
            logger.warning(message, role_parts['ref'], location=node)

        # replacing the pending_config_xref node with this reference
        node.replace_self(content)
Process the ``pending_config_xref`` nodes during the ``doctree-resolved``
    event to insert links to the locations of ``lsst-config-topic`` directives.

    See also
    --------
    `config_ref_role`
    `ConfigTopicTargetDirective`
    `pending_config_xref`