def _markdown_block(text):
    """
    Escape a block of text for markdown and use the code block markdown
    syntax.
    """
    result = []
    for line in text.splitlines():
        if line.strip() == '```':
            line = "'''"
        result.append(line)
    return '\n```\n{0}\n```\n'.format('\n'.join(result))
