I’m just switching to Joplin and importing my current notes. These are markdown with links to locally stored images. Importing the linked images as Joplin resources as far as I could make out was not supported, so the result was broken links in the notes. I didn’t find mention of any workarounds here or elsewhere, so today I modified the import to give basic support sufficient for my case.
I added the below in this location: https://github.com/laurent22/joplin/blob/master/ReactNativeClient/lib/services/InteropService_Importer_Md.js#L71
//TODO
// - only do this for links which could be valid local paths (not urls)
const noteResult = await Note.save(note, { autoTimestamp: false });
const regex = /!\[[^\]]*\]\((?<filename>.*?)(?=\"|\))?\)/g;
let match;
while ((match = regex.exec(noteResult.body)) !== null) {
console.log("ATTEMPTING TO ATTACH FILE: ", match[1], "AT POSITION: ", match.index)
const attachmentPath = path.resolve(path.dirname(filePath), match[1])
const resource = await shim.createResourceFromPath(attachmentPath);
const newNoteBody = noteResult.body.replace(match[0], Resource.markdownTag(resource))
noteResult.body = newNoteBody
await Note.save(noteResult, { autoTimestamp: false });
}
This has solved my problem for now.
I’d like to know if this would be a worthwhile addition to the app?
If so I can try and cover some more cases, add tests etc and make a PR.