def run(self):
        """Main entrypoint method.

        Returns
        -------
        new_nodes : `list`
            Nodes to add to the doctree.
        """
        from lsst.pex.config import ConfigurableField, RegistryField

        logger = getLogger(__name__)

        try:
            task_class_name = self.arguments[0]
        except IndexError:
            raise SphinxError(
                '{} directive requires a Task class '
                'name as an argument'.format(self.directive_name))
        logger.debug('%s using Task class %s', task_class_name)

        task_config_class = get_task_config_class(task_class_name)
        config_fields = get_task_config_fields(task_config_class)

        all_nodes = []
        for field_name, field in config_fields.items():
            # Skip fields documented via the `lsst-task-config-subtasks`
            # directive
            if isinstance(field, (ConfigurableField, RegistryField)):
                continue

            field_id = format_configfield_id(
                '.'.join((task_config_class.__module__,
                          task_config_class.__name__)),
                field_name)

            try:
                format_field_nodes = get_field_formatter(field)
            except ValueError:
                logger.debug('Skipping unknown config field type, '
                             '{0!r}'.format(field))
                continue

            all_nodes.append(
                format_field_nodes(field_name, field, field_id, self.state,
                                   self.lineno)
            )

        # Fallback if no configuration items are present
        if len(all_nodes) == 0:
            message = 'No configuration fields.'
            return [nodes.paragraph(text=message)]

        return all_nodes