code: def _handle_heading(self, token):
          
          level = token.level
          self._push()
          while self._tokens:
              token = self._tokens.pop()
              if isinstance(token, tokens.HeadingEnd):
                  title = self._pop()
                  return Heading(title, level)
              else:
                  self._write(self._handle_token(token))
          raise ParserError("_handle_heading() missed a close token")
docs: Handle a case where a heading is at the head of the tokens.