In terms of URL schemes working one platform and not another, that isn’t that uncommon. Different development teams and code bases that aren’t as shared as people would like (usually thanks to a history of separate development) are factors that can lead to this.
I’m not sure what action was being used on iOS that wasn’t being used on Drafts, but I had a look in the MindNode manual for the Mac and created this single step Drafts action that just uses the Mac URL scheme.
Looking through the MindNode AppleScript dictionary there’s no import option, only open, and while that works on importing OPML files (see the AppleScript example for this in the manual, or on GitHub), it doesn’t work on Markdown files from my brief testing. Therefore for a scripted solution, we could either look at first converting Markdown to OPML, or resigning ourselves to automating just the open via URL scheme (this leaves a confirmation dialog open, so without then calling in something like Keyboard Maestro to deal with that I just ended up banging my head on how to get past that to control MindNode to do the saving.
This example AppleScript allows you to select a folder, picks out all of the files with a file extension of
md (that’s what I use as my default markdown extension as it’s nice and short), grabs the content of each file in turn, URL encodes it, and then opens it using the URL scheme’s import option via the command line.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set folderPath to choose folder
set fileExtension to "md"
tell application "Finder"
set fileNames to name of every file of folderPath whose name extension is fileExtension
repeat with name in fileNames
set mdFile to alias ((folderPath as text) & name)
set mdContent to (read mdFile)
do shell script "open 'mindnode:///import?format=md&content=" & urlEncode(mdContent) & "&name='" & urlEncode(name)
set theTextEnc to ""
repeat with eachChar in characters of theText
set useChar to eachChar
set eachCharNum to ASCII number of eachChar
if eachCharNum = 32 then
set useChar to "+"
else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
set firstDig to round (eachCharNum / 16) rounding down
set secondDig to eachCharNum mod 16
if firstDig > 9 then
set aNum to firstDig + 55
set firstDig to ASCII character aNum
if secondDig > 9 then
set aNum to secondDig + 55
set secondDig to ASCII character aNum
set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
set useChar to numHex
set theTextEnc to theTextEnc & useChar as string
If you’re happy with the point of just creating and not saving, and you really do want to pass a file and a name in, you could do something simpler with a shell script; and probably even re-do the above, but I was so far in to trying to get the save working as well I figured I’d share anyway.
This script takes a file path and a name for the mind map as its arguments.
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv)"'
An example call from my testing looked like this:
~/scripts/md2mindnode.sh "/Users/stephen/Desktop/a.md" "temporary"
Hopefully, there’s something of at least limited use to you in those examples.