def METHOD_NAME(text: str) -> str:
    def replacer(match):
        language = match.group(1)
        code_block = dedent(match.group(2)).strip()
        return f"```{language}\n{code_block}\n```\n\n"
    text = RST_CODE_BLOCK_PATTERN.sub(replacer, text)
    return _render_markdown(text)