I’m a big fan of both iA Writer and Marked. While I do most of the writing for my blog in BBEdit, I enjoy writing in iA Writer for other non-blogging tasks. iA Writer does offer a Markdown preview to quickly ensure everything is formatted correctly but its functionality is limited. Marked on the other hand is a Markdown processing powerhouse. It offers many advanced options to both preview and export code. If you maintain a blog it’s the best $4 you’ll ever spend.
I’ve been using an AppleScript assigned to a hotkey to automatically preview Markdown written in BBEdit with Marked. It has always frustrated me that I didn’t have the same workflow in place for iA Writer. So naturally I adapted my BBEdit script to be iA Writer friendly. You can view the results below. I use Keyboard Maestro to execute the script but FastScripts and Alfred can both do the job. If you’re a Byword fan the same script will work. Simply, replace any reference to iA Writer with Byword.
-- Preview the currently active iA Writer document using Marked.
tell application "iA Writer"
activate
-- Ask iA Writer for it's active document.
set the_document to document 1
-- Save the document or prompt if not previously saved.
save the_document
-- If the file is saved, open it using Marked.
tell application "Marked"
set the_file to the_document's file
open the_file
-- Bring Marked forward so it becomes visible.
activate
end tell
end tell