code: def ignore_directives_and_roles(directives, roles):
      
      for directive in directives:
          docutils.parsers.rst.directives.register_directive(directive,
                                                             IgnoredDirective)
  
      for role in roles:
          docutils.parsers.rst.roles.register_local_role(role, _ignore_role)
docs: Ignore directives/roles in docutils.