typora-issues icon indicating copy to clipboard operation
typora-issues copied to clipboard

Update links when files are moved to subfolders or renamed

Open pfahlstrom opened this issue 5 years ago • 7 comments

I know this is a complicated feature request, but...

When using Typora as a wiki editor, it is essential to support updating links when files are moved or renamed. When a file is renamed in the sidebar, Typora should search all other files in the sidebar for links to that file and change the text of those links.

Also, when a subfolder is created in the sidebar and a file from the sidebar is moved into that subfolder, Typora should look in that file for links to other files in the sidebar and change those links appropriately (e.g. put ../ before local links). Also Typora should search all other files in the sidebar for links to that file and update the link to include the subfolder.

For example, our story bible wiki has 1800 files in it. If I take a character's page, such as Adolin.md, and put it into a new subfolder named Characters A, Typora should look through Adolin.md and update all links inside it to point to the parent folder, and then search through all files in the tree for links to (Adolin) and update them to say (Characters A/Adolin). Then when another file such as Bisig.md is moved into Characters B, it would update parent folder files to link to (Characters B/Bisig) and also search files in Characters A to link to (../Characters B/Bisig) if they link to his article.

Also there should be a way to select more than one file at a time in the sidebar in order to move them into or out of a subfolder.

Without these functions, Typora's use as a wiki editor is incomplete.

pfahlstrom avatar May 10 '19 19:05 pfahlstrom

This would be a killer feature. My only change would be that links are to the file path, not the expected URL path. Using your example, links should be

[Bisig](../Characters B/Bisig.md)

Not

[Bisig](../Characters B/Bisig)

Why?

  1. A set of cross-linked Markdown files should be self-contained, not dependent on a possible HTML rendering on a web server.
  2. There will be no ambiguity in the source, e.g. if two or more of Bisig.html, Bisig/index.html and Bisig.md exist in the folder.
  3. This is the form of link supported by many tools and platforms. It is the required form for GitHub.

It's the job of the render to translate the links appropriately when rendered to another format or platform. For example, a static site generator would translate

[Bisig](../Characters B/Bisig.md)

to one of the following, depending on configuration:

<a href="../Characters B/Bisig">Bisig</a>             - standard web sever deployment
<a href="../Characters B/Bisig/index.html">Bisig</a>  - local (non-web) HTML docs
<a href="../Characters B/Bisig.html">Bisig</a>        - "ugly URLs"

vassudanagunta avatar May 11 '19 20:05 vassudanagunta

Links without the extension currently function in Typora. So, updating the links should also work without the extension. For us, Typora would be both the editor and the viewing interface—we wouldn't deploy to something else later. It's only for internal use.

But in the realm of possibility, requiring an extension could be something where a strict/loose setting comes into play.

pfahlstrom avatar May 11 '19 20:05 pfahlstrom

Yes, I would LOVE this feature. I love linking two md files but it's very frustrating when you move a file and then have to search through all other files manually to make sure that the links aren't broken.

Coderdude112 avatar May 14 '20 15:05 Coderdude112

@abnerlee are there any plans to bring this to Typora? Even just a dumbed-down version that would update links when the file that is being pointed to gets moved? I really feel like a simple version of this would really help Typora

Coderdude112 avatar Jun 03 '20 01:06 Coderdude112

I'm not sure if this would work for yall but, I made this simple python program to update MD links when a file is renamed deleted or moved. You can check it out here: MD tools. You do have to download python3 but don't need to know any of it.

Hope this helps. -Coderdude112

Coderdude112 avatar Oct 15 '20 00:10 Coderdude112

3 years and still not implemented this?... Plus it's a paid app...

ironhak avatar Jun 28 '22 13:06 ironhak

Need this please having paid app.

tomer-ben-david avatar Jul 19 '22 04:07 tomer-ben-david

WebStorm IDE does this for Markdown just as it does for code moves/refactoring!

vassudanagunta avatar Mar 13 '23 09:03 vassudanagunta