Add an element to the parser.

        :param element: the element class.
        :param override: whether to replace the default element based on.

        .. note:: If one needs to call it inside ``__init__()``, please call it after
             ``super().__init__()`` is called.

def add_element(self, element, override=False):
        """Add an element to the parser.

        :param element: the element class.
        :param override: whether to replace the default element based on.

        .. note:: If one needs to call it inside ``__init__()``, please call it after
             ``super().__init__()`` is called.
        """
        if issubclass(element, inline.InlineElement):
            dest = self.inline_elements
        elif issubclass(element, block.BlockElement):
            dest = self.block_elements
        else:
            raise TypeError(
                'The element should be a subclass of either `BlockElement` or '
                '`InlineElement`.'
            )
        if not override:
            dest[element.__name__] = element
        else:
            for cls in element.__bases__:
                if cls in dest.values():
                    dest[cls.__name__] = element
                    break
            else:
                dest[element.__name__] = element