def md_heading(text, level=0):
    """
    Create title/heading.

    Level 0 means document title, level 1-3 - heading 1-3.
    """
    if level >= 3:
        return text
    if level == 0:
        return "{} {}".format("#", text)
    return "\n{} {}\n".format((level + 1) * "#", text)