import re


def parse_line(line):
    """ Function parses a line from SUMMARY.md, extracting
    relevant data"""

    # Find Indentation Level
    count = 0
    for c in line:
        if re.match('\s', c):
            count += 1
        else:
            break

    base = re.split("^[\s]*\* ", line)[1]
    (title, href) = base.split('](')
    title = re.sub('^\[', '', title)
    href = re.sub('\)[\s\S]*$', '', href)

    return count, title, href