code: def parse_config(self, config, toplevel=False):
          
          self.sitemap_path = config.get_path('sitemap')
  
          if self.sitemap_path is None:
              error('invalid-config',
                    'No sitemap was provided')
  
          self.include_paths = OrderedSet([])
  
          index_file = config.get_index()
          if index_file:
              if not os.path.exists(index_file):
                  error('invalid-config',
                        'The provided index "%s" does not exist' %
                        index_file)
              self.include_paths |= OrderedSet([os.path.dirname(index_file)])
  
          self.include_paths |= OrderedSet(config.get_paths('include_paths'))
  
          self.is_toplevel = toplevel
  
          self.tree = Tree(self, self.app)
  
          self.__create_extensions()
  
          for extension in list(self.extensions.values()):
              if toplevel:
                  extension.parse_toplevel_config(config)
              extension.parse_config(config)
  
          self.extra_asset_folders = OrderedSet(config.get_paths('extra_assets'))
docs: Parses @config setting up @self state.