import re


def parse_function_definition(deftxt: str) -> tuple[str, str]:
    """Parse a function definition"""

    # Connect multiple lines if so
    deftxt = re.sub(r'\n\s*', ' ', deftxt, flags=re.M) 

    # Split the definition line to the function name and the variables definition
    function_name, variables, _ = re.split(r'[()]', deftxt)

    # Remove type strings (e.g., Wave, String, etc) from the variables definition
    # The last slice is to remove unnecessary ', ' at the beginning
    variables = re.sub(r'(,|^)\s*(\[*)\S+\s+', r', \2', variables)[2:]

    parsed = f'---\ntitle: "{function_name}"\n---\n'\
    f'<p class="function_definition">{function_name}'\
    f'(<span class="function_variables">{variables}</span>)</p>\n'

    return function_name, parsed