import re


def _cleanse_line(line, main_character):
    """
    Cleanse the extracted lines to remove formatting.
    """
    # Strip the line, just in case.
    line = line.strip()
    
    # Clean up formatting characters.
    line = line.replace('\\'  , '')  # Remove escape characters.
    line = line.replace('[mc]', main_character)  # Standardize MC name.
    line = re.sub(r'{/?i}'    , '*', line)  # Convert italics to Markdown.
    line = re.sub(r'{cps=\d+}', '' , line)  # Remove scroll speed formatting.
    
    return line