Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving a note should update image links #151

Closed
madeindjs opened this issue May 28, 2020 · 2 comments
Closed

Moving a note should update image links #151

madeindjs opened this issue May 28, 2020 · 2 comments

Comments

@madeindjs
Copy link

When you insert a picture on a note placed on a root folder, image are save on root with link like this: ./picture.png.

Whene you update note's folder, picture not follow new folder and link is not updated so the link become broken.

@aisbergde
Copy link

That's why I would not use (sub) folders in my notes system but only tags and filenames to distinguish.

To solve this issue a monitoring should be done when moving a file and I should be asked if I want to update the links. Some WIKI pages systems are checking relations when moving files.

But I would not like that some auto update will change the notes not asking me.

And there is another issue: when moving notes files outside GitJournal directly then no detection could happen and the links will be wrong anyway. So I would not like the developer to spent much energy on change detection, it is not possible to cover all cases :-)

A possible way I see is to use Placeholders or variables. There is an similar issue in SchemaSpy with markdown comments in database documentation because the place of the generated file containing links to images can be on different places:
schemaspy/schemaspy#705

Something like {RootFolder}/images/picture.png could solve the issue.

But this would be a GitJounal specific solution. And the goal should be that the markdown notes are working not only inside GitJournal, but also outside.

I don't know if there are any markdown extensions allowing to define this {RootFolder} as variable. But what I learned, there are so many different markdown versions and the are even not compatible on such "simple" things like lists:

yzhang-gh/vscode-markdown#680 (comment)

Try this. It was a shock for me seeing this very different renderings results of the same markdown in different dialects

That's why I try:

  • not to use sub folders for the "main notes system" but to keep all notes in one folder, even if the app supports folders
  • if I use folders, then they should be on the same level like
    • notes
    • project1
    • images
      When I link from both folders (notes, project1) to the images folder, I could move notes and the link to images will still work and the markdown file content don't needs to be changed.

I try to use markdown elements which are supported by different markdown dialects: My blog page uses one dialect to render (https://github.com/michelf/php-markdown), GitHub and AzureDevOps using other dialects, ...

@mipro98
Copy link

mipro98 commented Jun 2, 2020

Trying to automate fixing links in a collection of markdown files is always more of a challenge than one might think. On the one side, most people do not want to break things just by renaming or moving a file but otherwise one doesn't want to have own content automatically manipulated from scripts which always is a risk of unnoticed data loss.

Because of this reason I would also be okay without the App trying to preserve correct links.

OT:
Out of frustration on this whole topic I created a python script some time ago to at least detect non-working markdown links in large markdown-files collections. Then, I implemented basic functionality for fixing them if only the path (but not the filename) was wrong. It's basically just some regex magic to detect markdown links and some relative-path conversions. It's not complete and not really tested to a larger extent but maybe it can help someone. It's intended to be used as a python module: https://gist.github.com/mipro98/efca63be2c3c38b70b5ced63df7c648f
A little demo on how one might use this script is here: https://gist.github.com/mipro98/149f18fe569dad7bc385d89c2065e48c

@vHanda vHanda changed the title Broken image link when move note Moving a note should update image links Nov 9, 2020
@vHanda vHanda added the feature label Nov 9, 2020
@GitJournal GitJournal locked and limited conversation to collaborators Nov 19, 2022
@vHanda vHanda converted this issue into discussion #805 Nov 19, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants