Exemplo n.º 1
0
 def _update(path, backlinks={}):
     links = S.markdown_links_search(path)
     if links:
         for link in links:
             name = os.path.basename(link)
             backs = set((backlinks[name])) if name in backlinks else set()
             backs.add(path)
             backlinks.update({name: list(backs)})
     return backlinks
Exemplo n.º 2
0
def show_markdown_links():
    """Show MarkDown links contained in currently opened file"""
    filename = U.get_typora_filename()
    if filename:
        link_list = S.markdown_links_search(filename, filename=True)
        matched_list = []
        for link in link_list:
            path = U.get_abspath(link, query_dict=True)
            matched_list.append(F.get_file_info(path))
        if not matched_list:
            Display.show({
                "title": "No MarkDown Link is found in the current file.",
                "subtitle": ""
            })
        else:
            display_matched_result(filename, matched_list)
    else:
        Display.show({
            "title": "Error!",
            "subtitle": "No file is opened in Typora."
        })