I already made it work with a markdownItPlugin content script, but here is the problem I'm having:
The contentScriptMarkdown requires the fs library from Node js to open a xml file, and the fs library requires the path to the file to open it. I hard coded the path to the file on my computer (the fs library only supports absolute paths), but I would like to make it dynamic, so a normal user can select the path from the plugin settings.
The problem is the markdownItPlugin can't retrieve the settings values, unlike in the index.ts script where I can use the await joplin.settings.value('Setting'); function.
My idea was to communicate somehow the content script with the plugin. I found in the doc that I can communicate with the plugin from the content script, but I already struggled enough with it and I can't get it to work. The most I could do was to print the response from the plugin on the console (just as the postMessage demo).
If you have an idea or something to help I'll be gratefull.
My current code in the MarkdownItPlugin is the following (the hard coded path is in line 7):
You might be able to find the aolution in the code of the backup plugin. afaik one can specify the location of the backup file. @JackGruber played around with relative file paths for a while I think. Not sure if he ever made relative paths work though.