Homepage    |    GitHub    |    API    |    FAQ

Get path of the note uploaded from local dir?

Is there a way to get the path of the imported markdown file? The note attributes mentioned here (Joplin Data API | Joplin) only have source_url which is empty if the markdown file is uploaded locally.

I am using "onNoteChange" event listener to extract the newly added note. I am able to extract the note but not able to find the full path to the note file anywhere.

I doubt this information is persisted. You can easily check -- import a note, then open your database and see if you can find the original path.

I can't. The data is not persisted.

Is there a way to get the path using import module maybe?

I doubt that. Why do you need it? Maybe there's another way to achieve your goal.

Okay. so here is the problem statement.

I have markdown files on my system which I want to import into joplin. When the files are imported, the image and video links are broken because they refer assets on disk stored locally. The structure for each markdown is as follows:

notes.md (This is the note file which refers to images and videos in their respective directories.

images

  • Image1

  • Image 2

videos

  • Video 1

  • Video 2

based on the parent folder of the markdown file, I wanted to create path for the image and video file and upload them as a resource in joplin. Once done, I would change the markdown file content to refer to those resources rather than images and videos path.

Ok, makes sense now.
Isn't it pretty much this bug - Import of markdown directory only adds linked images · Issue #4433 · laurent22/joplin · GitHub ?

Not really. That issue mainly talks about pdfs & pptx files. It mentions that the code works for images. I think importing markdown directory behind the scene is doing same kind of work. Where can I look for the markdown (Directory) code in the Joplin github repo?. I am not able to find it.