Home Link

Hello, my name is Brett Terpstra, and it’s nice to meet you. Elegant solutions to complex problems. Curious?

Preview a full Scrivener document in Marked, live

Preview a full Scrivener document in Marked, live

BooneJS tweeted me a script yesterday that takes my original “scrivwatch” script and makes it handle full Scrivener documents. It scrapes the XML file to get the order of RTF files in the document, then used the original method to convert and concatenate all of it into a plain text file. If you write in Scrivener using Markdown, you get a file that Marked can preview as a rendered document with any theme. It uses the original datestamp polling to watch for any change in any of the files in the project and update Marked within a second or two.

I took the script and ran with it this morning, switching it over to REXML parsing and adding in titles for sections and pages. The original script broke on a couple of my projects, but the recursive XML handler I set up fixes the issue.

To run it, you just need to save the script on your drive and make it executable (chmod a+x /path/to/scrivwatcher.rb). Then you can run /path/to/scrivwatcher.rb /path/to/YourProject.scriv. Marked will open automatically and changes will be reflected every time you save. To stop the script, you need to type Control-c in the terminal window you ran it from.

I’m going to try to wrap this into a droplet that you can just drop a Scrivener project on and launch both Scrivener and Marked with scrivwatcher syncing the two. Once I’ve determined whether that’s win or fail, I’ll update the Marked Bonus Pack with it. Yes, I will eventually find time to build this functionality into Marked, along with the rest of the Bonus Pack scripts.

The script is currently a gist on GitHub if you want to play with it. I’ll be updating the gist as I have time to clean it up and make a few things (much) more elegant. If you want to fork and help me out, it’s always appreciated!

One Response to “Preview a full Scrivener document in Marked, live”

  1. Mathew says:

    This is a very exciting development. My geek skills are paltry, so I’ll be waiting for the droplet version. And, of course, integration into Marked itself will be fantastic. Really looking forward to the droplet as I use Marked daily, and use Scrivener for all my larger writing projects.

Leave a Reply

Comments may use standard Markdown formatting


Notify me of followup comments via e-mail. You can also subscribe without commenting.

Entries (RSS) and Comments (RSS), or Subscribe by Email