import re


def github_to_markdown_body(body: str) -> str:
    """
    Generate a markdown body from the GitHub provided one.

    :param body: The markdown body provided by the GitHub Releases.
    :returns: A markdown body.
    """

    body = re.sub(
        r"#(\d{1,5})", r"[#\1](https://github.com/rucio/rucio/issues/\1)", body
    )

    REPLACE_CHARACTERS = {"<": r"\<", ">": r"\>", "\r\n": "\n", "\n#": "\n\n##"}

    for before, after in REPLACE_CHARACTERS.items():
        body = body.replace(before, after)

    return body