def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
        """Called at the start of every HTML tag."""
        # We only care about the opening tag for headings.
        if tag not in _HEADER_TAGS:
            return

        # We are dealing with a new header, create a new section
        # for it and assign the ID if it has one.
        self.is_header_tag = True
        self.section = ContentSection()
        self.data.append(self.section)

        for attr in attrs:
            if attr[0] == "id":
                self.section.id = attr[1]
Called at the start of every HTML tag.
mkdocs/contrib/search/search_index.py