def format_rst_file(title: str, action: str, parameters: list, action_parameter='', title_size='=') -> list:
    """
    Creates the text for the generated rst doc file.

    :param title: The title text for the doc.
    :param action: The action to be called i.e. '..  toctree::'.
    :param parameters: The passed in values to the action i.e. list of file names of other rst files to index.
    :param action_parameter: The action's parameter i.e. ':maxdepth: 1'.
    :param title_size: The text size of the title.
    :return: The generated text for the rst doc file, split into a list of lines.
    """
    if action_parameter != '':
        action_parameter = f'    {action_parameter}\n'
    lines = [title, title_size * len(title), '', action, action_parameter]
    for parameter in parameters:
        lines.append(f'    {parameter}')
    lines = [line + '\n' for line in lines]
    return lines