def remove_markdown(text: str, *, ignore_links: bool=True) -> str:
    'A helper function that removes markdown characters.\n\n    .. versionadded:: 1.7\n\n    .. note::\n            This function is not markdown aware and may remove meaning from the original text. For example,\n            if the input contains ``10 * 5`` then it will be converted into ``10  5``.\n\n    Parameters\n    -----------\n    text: :class:`str`\n        The text to remove markdown from.\n    ignore_links: :class:`bool`\n        Whether to leave links alone when removing markdown. For example,\n        if a URL in the text contains characters such as ``_`` then it will\n        be left alone. Defaults to ``True``.\n\n    Returns\n    --------\n    :class:`str`\n        The text with the markdown special characters removed.\n    '

    def replacement(match):
        groupdict = match.groupdict()
        return groupdict.get('url', '')
    regex = _MARKDOWN_STOCK_REGEX
    if ignore_links:
        regex = f'(?:{_URL_REGEX}|{regex})'
    return re.sub(regex, replacement, text, 0, re.MULTILINE)
A helper function that removes markdown characters.

.. versionadded:: 1.7

.. note::
        This function is not markdown aware and may remove meaning from the original text. For example,
        if the input contains ``10 * 5`` then it will be converted into ``10  5``.

Parameters
-----------
text: :class:`str`
    The text to remove markdown from.
ignore_links: :class:`bool`
    Whether to leave links alone when removing markdown. For example,
    if a URL in the text contains characters such as ``_`` then it will
    be left alone. Defaults to ``True``.

Returns
--------
:class:`str`
    The text with the markdown special characters removed.
def remove_markdown(text: str, *, ignore_links: bool=True) -> str:
    'A helper function that removes markdown characters.\n\n    .. versionadded:: 1.7\n\n    .. note::\n            This function is not markdown aware and may remove meaning from the original text. For example,\n            if the input contains ``10 * 5`` then it will be converted into ``10  5``.\n\n    Parameters\n    -----------\n    text: :class:`str`\n        The text to remove markdown from.\n    ignore_links: :class:`bool`\n        Whether to leave links alone when removing markdown. For example,\n        if a URL in the text contains characters such as ``_`` then it will\n        be left alone. Defaults to ``True``.\n\n    Returns\n    --------\n    :class:`str`\n        The text with the markdown special characters removed.\n    '

    def replacement(match):
        groupdict = match.groupdict()
        return groupdict.get('url', )
    regex = _MARKDOWN_STOCK_REGEX
    if ignore_links:
        regex = f'(?:{_URL_REGEX}|{regex})'
    return re.sub(regex, replacement, text, 0, re.MULTILINE)