def METHOD_NAME(self):
    self.filenames = set()
    if self.arguments[0] == 'lexers':
        out = self.document_lexers()
    elif self.arguments[0] == 'formatters':
        out = self.document_formatters()
    elif self.arguments[0] == 'filters':
        out = self.document_filters()
    else:
        raise Exception('invalid argument for "pygmentsdoc" directive')
    node = nodes.compound()
    vl = ViewList(out.split('\n'), source='')
    nested_parse_with_titles(self.state, vl, node)
    for fn in self.filenames:
        self.state.document.settings.record_dependencies.add(fn)
    return node.children