def METHOD_NAME(match):
    full = match.group(0)
    link_name = match.group(1)
    link = match.group(2)
    frag = match.group(3)
    if link.startswith('http'):
        return full
    elif link.endswith('.md') or '.md#' in link:
        if not frag:
            relative_path = ''
            if not link.startswith('.'):
                relative_path = '../'
            _rel_path = os.path.normpath(os.path.join(name, relative_path, link))
            for fpath in file_link_name:
                if _rel_path == fpath:
                    frag = '#' + file_link_name[fpath]
        return '[%s](%s)' % (link_name, frag)
    elif link.endswith('.png') or link.endswith('.jpeg') or link.endswith('.svg') or link.endswith('.gif') or link.endswith('.jpg'):
        # special handing for pic
        img_link = re.sub(r'[\.\/]*media\/', './media/', link, count=0, flags=0)
        return '[%s](%s)' % (link_name, img_link)
    else:
        return full