To use pandoc, wouldn’t you would have to call Terminal?
Maybe you can work with something along these lines:
set theItem to the selection
set itemPath to path of theItem
set itemName to name of theItem
tell application "Terminal"
set currentTab to do script ("pandoc --wrap=preserve -s " & itemPath & " -o ~/Desktop/" & itemName & ".pdf")
delay 5
do script ("exit") in currentTab
end tell
Using shell script / CURL you could make use of e.g. Docverter somehwere along these lines:
(https://docverter.com/api/)
do shell script "curl POST http://c.docverter.com/convert from=markdown to=pdf input_files[]=@" & itemPath & "-- output " & (name of theItem) & ".pdf && open " & name of thisItem & ".pdf"
DTPO has no idea what to do with the received PDF though. I don’t know how to fetch the file and place it inside the current group
. Perphaps you can get the location of the file and use it to construct a path. I’m too unfamiliar with the architecture though, sorry.
set itemLocation to location of thisItem
set parentPath to id of current group
None of this working code but merely some ideas.
Edit:
Using this: how to get the path to a group I reckoned the Terminal approach might work, but in the end I’m promped with some unicode problem.