def find_links(this_file):
"""Read links of a markdown file.
Return a list of (target, title, lineno) pairs where title can be None.
"""
result = []
with common.slashfix_open(this_file, 'r') as f:
for match, lineno in common.find_links(f):
target = match.group(2)
if '#' in target:
file, title = target.split('#', 1)
if not file:
# link to this file, [blabla](#hi)
file = posixpath.basename(this_file)
else:
file = target
title = None
result.append((file, title, lineno))
return result
评论列表
文章目录