import re


def fix_links_in_rst(text: str) -> str:
    """
    Fixes :link:s that get corrupted by from-markdown conversion.

        :link:``some`` becomes :link:`some`

    :param text: str
    :return: str
    """
    def _repl(match):
        g = match.groups()
        return f":{g[0]}:`{g[1]}`"

    text = re.sub(
        r":([^:]+):``([^`]+)``",
        _repl,
        text,
    )

    return text