Keep image references in synch with changed note name

When a title is changed, the name of the note is also changed on disk. In addition, attachment names are changed. If a note contains image references they will be using the original file names. The reference no longer works.

It would be desirable for Notenik to scan the note contents for references to files which will be renamed, and to update the references.

I think that could cause some inconvenience if more than one note referenced the same image. Personally, I name my images in a way that makes it easy for me to reference them in another note, therefore would not want auto-change. Maybe it could be a option in the settings, so that it could fit various approaches

Let me look into this. There may be a way to accomplish something like this, without negative impacts to others.

1 Like

How are you managing the images which are shared across several notes? I can imagine work-arounds, though you may not want to utilise a work-around if it isn’t congruent with your workflow. One thing that comes to mind is to have a note which is your “image archive”. If you attach all images to this note, knowing that you will not ever change the name, then you can reference the attachments from any other note.

At present attachments get prefixed with the title of the note and have a unique suffix ( or mid-fix :smile: ) provided by the user. When a note is renamed the images are renamed.

This only effects images which are stored as attachments, that is, things that Notenik stores. If you control the process of storing images yourself (a) you don’t get to see them in the attachments list, but (b) they won’t be affected by changes to the note title.

Below is my setup, all images are inside the assets folder. In any note I can reference any image in the body text with the following syntax ![](assets/image.png)

1 Like

This is a good example of Notenik’s intentional flexibility. Notenik gives you a gui feature that allows you to attach files, and to display image files. But at the same time it doesn’t care if you “pop the hood” and create your own folder(s) within a Collection, and then reference those files from your Markdown. It’s your choice!

1 Like

See the latest beta and let me know if this helps.

That’s exactly what I expected to happen :smile_cat:

To test I changed the note title. On saving, Notenik made changes to the file name, and updated image references that used the file name. The images are displayed in the display window.

thank you @hbowie

You’re welcome! Thanks for the suggestion, @Malcolm !