I write a lot of things in Markdown and use Pandoc for a number of things. I haven't been able to find a way to convert markdown to pages format. At times I need to send a document in either docx or pages. It's easier in pages.
Pandoc of course is essential:
pandoc -o document.docx document.md
It'd be great if I could get .docx to .pages conversion working in the command line somehow. So I fiddled. For too long.
Apple Script is able to accomplish this - and here is the basic thing of it:
set old_doc to POSIX file "/Users/username/path/to/docx/file.docx" as string
set new_doc to POSIX file "/Users/username/path/to/pages/file.pages" as string
tell application "Pages"
set thisDoc to open old_doc
save thisDoc in file new_doc
close thisDoc
end tell
Note: if you don't tell Pages to activate
then this process will probably remain hidden behind other open windows - it's also quite fast
I have yet to finish this little project. I plan to script it out more using osascript
so that I will just be able to type mdtopages document.md
in my terminal and end up with document.pages
.
Top comments (1)
Hi ! That's exactly what I'm looking to do. Is the conversion going well? Did you finish the project? Thank you for sharing.