[
  {
    "path": "AppleScript/OpenInMarked.applescript",
    "content": "-- Open in Marked 2\n-- Attempts to open the currently-edited document in Marked 2 for previewing\n-- Based on ideas by Lri <https://gist.github.com/1077745>\n-- with contributions from Donald Curtis <https://github.com/milkypostman>\n\n---NV/nvALT configuation---------------------------------------------------\n-- * Set NV/nvALT to store text files to disk\n-- * Enter the full UNIX/POSIX path to your notes folder in nvNoteFolder\n-- * Enter your default file extension (.txt,.md,etc.) in nvNoteExtension\n-- It won't always work, but it will try. It's a temporary hack; \n-- nvALT will soon have an AppleScript command to access the file directly.\nproperty nvNoteFolder : \"/Users/username/pathtonotes/\" -- include trailing slash\nproperty nvNoteExtension : \".md\" -- include leading dot\n---------------------------------------------------------------------------on run {}\ntell application \"System Events\"\n\tset frontApp to (name of first process whose frontmost is true)\nend tell\n\nset f to false\nset flist to {}\n\n--Marked 2 (if Marked 2 is foreground, hide Marked 2 and end script)\nif frontApp is \"Marked 2\" then\n\ttell application \"System Events\" to set visible of process \"Marked 2\" to false\n\treturn\n\t--Notational Velocity/nvALT\nelse if (frontApp is \"Notational Velocity\") or (frontApp is \"nvALT\") then\n\ttry\n\t\ttell application \"System Events\" to tell process frontApp\n\t\t\t-- Grab the text in the search field, hopefully this will be the filename\n\t\t\tset p to value of text field 1 of group 1 of toolbar 1 of window 1\n\t\t\ttry -- look for it in nvNoteFolder with the nvNoteExtension suffix\n\t\t\t\tset f to POSIX file (nvNoteFolder & p & nvNoteExtension) as alias\n\t\t\tend try\n\t\t\tif f is false then -- if we didn't get a bite...\n\t\t\t\ttry -- attempt with .txt\n\t\t\t\t\tset f to POSIX file (nvNoteFolder & p & \".txt\") as alias\n\t\t\t\tend try\n\t\t\tend if\n\t\t\tif f is false then -- report the failure\n\t\t\t\tset _res to display dialog \"Couldn't open \" & nvNoteFolder & p & nvNoteExtension & \". Check your property settings in the script.\" buttons {\"OK\"}\n\t\t\t\treturn\n\t\t\tend if\n\t\tend tell\n\ton error errNO\n\t\tset _res to display dialog \"Couldn't open \" & nvNoteFolder & p & nvNoteExtension & \". Check your property settings in the script.\" buttons {\"OK\"}\n\t\treturn\n\tend try\n\t--Finder (open selected file)\nelse if frontApp is \"Finder\" then\n\ttell application \"Finder\" to set flist to (get selection)\nelse if frontApp is \"Emacs\" then\n\tset emacsclient to false\n\ttell application \"Finder\"\n\t\tif exists POSIX file \"/usr/local/bin/emacsclient\" then\n\t\t\tset emacsclient to \"/usr/local/bin/emacsclient\"\n\t\tend if\n\tend tell\n\tif emacsclient is not false then\n\t\tset f to do shell script emacsclient & \" -e '(first (delete nil (mapcar (function buffer-file-name) (buffer-list))))' | sed 's/^\\\"//' | sed 's/\\\"$//'\" as string\n\t\tif f is not \"nil\" then\n\t\t\tset f to f as POSIX file as alias\n\t\telse\n\t\t\tset f to false\n\t\tend if\n\tend if\n\t--Byword (open current document)\nelse if frontApp is \"Byword\" then\n\ttell application frontApp to set f to file of document of window 1 as alias\nelse if frontApp is \"TextEdit\" then\n\ttell application frontApp to set f to path of document of window 1 as POSIX file\n\t--Fallback (attempt \"path of document 1\" and see if current app responds)\nelse if frontApp is \"Mou\" then\n\ttell application \"System Events\"\n\t\tset f to text 17 thru -1 of (value of attribute \"AXDocument\" of first window of process \"Mou\" as text)\n\tend tell\nelse if frontApp is \"TextWrangler\" then\n\ttell application frontApp to set f to file of document of window 1 as alias\nelse if frontApp is \"DEVONthink Pro\" then\n\ttell application \"DEVONthink Pro\" to set f to path of content record of think window 1\nelse\n\ttell application \"System Events\"\n\t\ttell process frontApp\n\t\t\ttry\n\t\t\t\tset isScriptable to has scripting terminology\n\t\t\ton error\n\t\t\t\tset isScriptable to false\n\t\t\tend try\n\t\tend tell\n\tend tell\n\tif isScriptable then\n\t\ttry\n\t\t\ttell application frontApp to set f to POSIX file (path of document 1 of window 1) as alias\n\t\tend try\n\t\tif f is false then\n\t\t\ttry\n\t\t\t\ttell application frontApp to set f to POSIX file (path of first document) as alias\n\t\t\tend try\n\t\tend if\n\t\tif f is false then\n\t\t\ttry\n\t\t\t\ttell application frontApp to set f to POSIX file (text 17 thru -1 of (get URL of document 1)) as alias -- BBEdit\n\t\t\tend try\n\t\tend if\n\tend if\nend if\n\nif f is false and flist is not {} then\n\ttell application \"Marked 2\"\n\t\tactivate\n\t\trepeat with afile in flist\n\t\t\topen (afile as alias)\n\t\tend repeat\n\tend tell\nelse if f is not false then\n\ttell application \"Marked 2\"\n\t\tactivate\n\t\topen f\n\tend tell\nend if\nend run"
  },
  {
    "path": "BBEdit/Open in Marked.applescript",
    "content": "-- Place in ~/Library/Application Support/BBEdit/Scripts\n-- Use from the Script menu bar item while editing a Markdown document (must be saved first)\n-- Assign a shortcut key in BBEedit Preferences->Menu Items\ntell application \"BBEdit\" to set mdFile to file of document of window 1\ntell application \"Marked 2\"\n\tactivate\n\topen mdFile\nend tell\n"
  },
  {
    "path": "Emacs/dot.emacs.txt",
    "content": "(defun markdown-preview-file ()\n  \"use Marked 2 to preview the current file\"\n  (interactive)\n  (shell-command \n   (format \"open -a 'Marked 2.app' %s\" \n       (shell-quote-argument (buffer-file-name))))\n)\n(global-set-key \"\\C-cm\" 'markdown-preview-file)\n"
  },
  {
    "path": "README.md",
    "content": "# Marked Bonus Pack\n\nThe Marked Bonus Pack is a collection of scripts, commands, services, and\ndocumentation. Some work with multiple editors, some are specific to certain\neditors. The Services will generally work with any editor that has the necessary\ncapabilities. The rest are organized in folders based on the application they\nwork with.\n\nThese items work with [Marked 2](http://marked2app.com). If you need support for\nthe original version of Marked, you will need to download [Marked Bonus Pack\n1.5](https://github.com/kotfu/marked-bonus-pack/releases/tag/v1.5)\n\n## Works With Marked\n\nSome applications work with Marked out of the box and don't require you to\ninstall anything else. These applications take advantage of the Marked\n[Streaming Preview](https://marked2app.com/help/Streaming_Preview.html) feature.\nThis feature requires developers to implement Marked support in their\napplication. Some apps will have a Preview command to manually send updates to\nMarked, others will automatically update without any interaction from the user.\n\n### Drafts\n\n[Drafts for Mac](https://getdrafts.com/) includes support for Streaming Preview,\nbut you must enable it:\n\n- Open Drafts\n- Click on the **Drafts > Preferences** menu (or press ⌘,)\n- Click on the `General` tab\n- Select the `Enable Marked App Streaming Preview support` checkbox.\n- Click the `Open Marked` button to launch Marked and open the `Streaming Preview` window\n- Close the Drafts Preferences window\n\nNow you have a live Marked preview that updates as you type in Drafts.\n\nTip: You can re-open the `Streaming Preview` window in Marked by clicking the\n**Preview > Streaming Preview** menu.\n\n### nvALT\n\nEnable the Streaming Preview in [nvALT](https://brettterpstra.com/projects/nvalt/)\nby selecting the **Preview > Streaming Preview in Marked** menu option.\n\n### The Archive\n\n[The Archive](https://zettelkasten.de/the-archive/) includes support for\nStreaming Preview. Choose the **Note > Stream Preview to Marked** menu option to\nenable. The Marked preview updates as you type, no saving required.\n\n\n## Installation and Usage\n\nIf you aren't familiar with GitHub, click on the green button that says `Code`\nat the top of this page and then choose `Download Zip`. Unzip the file on your\ncomputer.\n\nIf you are familiar with GitHub, you know what to do.\n\nFor some of the installation targets listed below — specifically\n__Services__, __BBEdit__, __Sublime Text__, and __iA Writer__ — you can use\nthe provided\n[install](./install) script.\n\n### Services\n\nPut the Services in `~/Library/Services`, where `~` is your user's home folder.\nIf you want hotkeys for the services, assign them in **System\nPreferences > Keyboard > Shortcuts > Services**.\n\n### BBEdit\n\nPlace `BBEdit/Open in Marked.applescript` in `~/Library/Application Support/BBEdit/Scripts/`.\nUse from the Script menu bar item while editing a Markdown document (must be\nsaved first). You can assign a keyboard shortcut in BBEedit **Preferences > Menus\n& Shortcuts**.\n\n### TextMate\n\nDouble-click on the `Marked 2` bundle to open it in TextMate's Bundle Editor.\nYou can access the preview commands using the ⌃⌥M keyboard\nshortcut. There are two of these commands, one previews the current document and\nwill watch the associated file for future changes, the other previews the\ncurrent selection using a temporary file. The latter will not update\nautomatically.\n\n### Sublime Text\n\nCopy the `Marked 2.sublime-build` file to `~/Library/Application Support/Sublime\nText 3/Packages/User/`. It will show up in the **Build Systems** section of the\n**Tools** menu in Sublime. When selected, pressing ⌘B will open the current file\nin Marked for preview. Once opened, changes to the file will be tracked\nautomatically by Marked.\n\n(This extension will also work with Sublime Text 2. Just copy\n`Marked 2.sublime-build` to\n`~/Library/Application Support/Sublime Text 2/Packages/User/`.)\n\n### Vim\n\nVia [A Whole Lot of Bollocks](http://captainbollocks.tumblr.com/post/9858989188/linking-macvim-and-marked-app).\nAdd the following to your .vimrc file:\n\n\t:nnoremap <leader>m :silent !open -a Marked\\ 2.app '%:p'<cr>\n\n**\\m** (or your preferred leader) will now open the current file in Marked.\n\nFrom [dixius99](https://github.com/dixius99):\n\nYou may prefer `:Marked` instead of using the leader key to launch Marked. To do that,\nadd the following to your .vimrc:\n\n\tcommand Marked :silent !open -a Marked\\ 2.app '%:p'\n\nThe word right after \"command\" is what triggers the action. It can be anything\nyou want, but has to start with a capital letter.\n\n### iA Writer\n\nVia [stephenhowells](https://gist.github.com/stephenhowells/4599997):\n\nCopy `iAWriter/Open in Marked.applescript` to `~/Library/Scripts/Applications/iA\nWriter/`. Run by clicking the **Script > iA Writer > Open in Marked** menu.\n\n### Emacs\n\nVia [Barry](http://spacebeast.com/blog/)\n\nInstall the `dot.emacs.txt` file in one of the following ways (depending on how\nyou have configured your emacs startup):\n\n 1. Append the contents of `dot.emacs.txt` to `~/.emacs`\n 2. Append the contents of `dot.emacs.txt` to `~/.emacs.d/init.el`\n 3. Copy `dot.emacs.txt` to `~/.emacs.d/marked2.el` and ensure it is loaded by `~/.emacs.d/init.el`\n \nSee\n[The Emacs Initialization File](http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html)\nfor more information about emacs startup.\n\nOnce installed, restart Emacs. Press **Control-C m** to preview the file\nassociated with the current buffer in Marked 2.\n\n### Visual Studio Code\n\nThis project does not contain anything to help you integrate with [Visual Studio\nCode](https://code.visualstudio.com/). However, Fabian Morón Zirfas has created\nan [Open in Marked\nExtension](https://marketplace.visualstudio.com/items?itemName=fmoronzirfas.open-in-marked).\nOnce the extension is installed, you can open the current file in Marked 2 by\ntyping ⇧⌘P and then typing `marked` to narrow the list of commands, and then\nselecting \"Open In Marked 2\".\n\nTo bind it to a keyboard shortcut, select the **Code > Preferences > Keyboard Shortcuts**\nmenu to open the keyboard shortcuts editor. Type `marked` to narrow the list\nof commands, and then double-click on \"Open in Marked 2\". Type the keyboard shortcut\nyou want, and press **Return**.\n\nSee [Key Bindings for Visual Studio Code](https://code.visualstudio.com/docs/getstarted/keybindings)\nfor more information on binding shortcuts to commands.\n\n### AppleScript\n\nThere's one AppleScript included that performs essentially the same function as\nthe Open in Marked Service, but with some special accommodations for [Notational\nVelocity](http://notational.net/) and\n[nvALT](http://brettterpstra.com/project/nvalt/). In order to use it, two\nconfiguration variables need to be edited at the top of the script. Open the\n.applescript file in AppleScript Editor and modify the `property` lines at the\ntop, then save it as a compiled script (scpt) file. You can then run it from the\nAppleScript menu (enabled in the AppleScript Editor preferences), or from a\nhotkey-capable application like\n[FastScripts](http://www.red-sweater.com/fastscripts/).\n\n### Watchers\n\nMarked version 1 required some watcher scripts to work with Scrivener and\nMarsEdit. Marked 2 has built in support for these applications, and no watcher\nscripts are required.\n\nMore info: <http://brettterpstra.com/marked-scripts-nvalt-evernote-marsedit-scrivener/>\n\n### Notes:\n\nThe easiest way to use these scripts is to put them in a convenient folder (I\nuse `~/scripts`) and run `chmod a+x path/to/script.rb` to make them executable.\nYou can then just type the path and script name and hit Enter (e.g.\n`~/scripts/everwatch.rb`). They will run and watch for changes in their specific\napplication until you cancel the command by typing `Control-c`.\n\nThe scripts will create a file in your home directory (modifiable in the script)\ncalled 'Marked Preview.md'. Open that file in Marked; Marked will watch that\nfile for changes that the scripts make.\n\nYou can create LaunchAgents for any of these and run them automatically in the\nbackground if you know what you're doing. If you don't, you can still use an app\nlike [Lingon](http://www.peterborgapps.com/lingon/) to do it.\n\n#### Evernote\n\nTo keep the 'Marked Preview.md' file synced with whatever note you're currently\nediting in Evernote, start the script by running `~/path/to/everwatch.rb` in\nTerminal. The script watches for changes to timestamps on any directory in\nEvernote's data folder. This shouldn't need to be adjusted. To update Marked,\nyou'll need to have \"~/Marked Preview.md\" open and then hit \"Command-S\" in your\nEvernote note. The autosave on Evernote will work, but it takes longer. \n\nThe HTML of the note is captured via AppleScript and run through `textutil` to\nremove the HTML formatting. This means that embedded images won't come through,\nbut those probably would have broken anyway. The script is specifically\nexpecting you to write your notes in Markdown. If you're not, I'm not sure why\nyou'd want a Marked preview anyway. Inline HTML works, but you have to watch\nyour quote marks very carefully. Evernote likes to convert the single and double\nquote marks you type into \"smart quotes\", which Marked doesn't interpret as\nHTML.\n\nThis watcher will not reliably if you have multiple Evernote user id's.\n\nEven with \"Command-S\" there's still a 4-5 second delay on the update, as it\ntakes a bit for Evernote to write out to the file, the script to poll through\nand notice the change, the content to be pulled via AppleScript and written to\nthe preview file and then for Marked to pick up on the change there. Considering\nall of that, 4-5 seconds isn't too bad. If someone can think of a faster way,\nI'm certainly open to it.\n\n#### Notational Velocity/nvALT\n\nIf you store your notes as plain text files in NV/nvALT, you can just open the\nnotes folder in Marked 2 and it will always display a preview of the\nmost-recently edited file.\n\nWatcher script:\n\nIf you're using [Notational Velocity][nv] (or my fork, [nvALT][nvalt]), you can\ntell it to save your notes as text files on your drive. This script will watch\nthese text files for updates, then display the contents of the most\nrecently-edited note. It's a workable solution, at least until I get better\nintegration worked into nvALT directly.\n\nYou need to configure the script to point to your chosen folder for note\nstorage, and if you're using any unique extension, you'll need to add to or\nmodify the list in the script. It should be pretty obvious what needs to be set\nif you look at the top of the script.\n\n[nv]: http://notational.net\n[nvalt]: http://brettterpstra.com/projects/nvalt\n\n## Running multiple Custom Pre/Processors\n\nIf you use Marked's Custom Processor and/or Preprocessor functionality, you may want \nto check out [Conductor](https://github.com/ttscoff/marked-conductor \"ttscoff/marked-conductor\"), \nwhich allows you to run different processors based on natural language conditions. For example, \nrun one custom (pre)processor for Obsidian notes, a different one for blog posts, and \nanother one for GitHub READMEs. There's a sample config available at \n[github.com/ttscoff/conductor-config/](https://github.com/ttscoff/conductor-config/).\n"
  },
  {
    "path": "Services/Open Current File in Marked.workflow/Contents/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSServices</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>NSMenuItem</key>\n\t\t\t<dict>\n\t\t\t\t<key>default</key>\n\t\t\t\t<string>Open Current File in Marked</string>\n\t\t\t</dict>\n\t\t\t<key>NSMessage</key>\n\t\t\t<string>runWorkflowAsService</string>\n\t\t</dict>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "Services/Open Current File in Marked.workflow/Contents/document.wflow",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>AMApplicationBuild</key>\n\t<string>381</string>\n\t<key>AMApplicationVersion</key>\n\t<string>2.4</string>\n\t<key>AMDocumentVersion</key>\n\t<string>2</string>\n\t<key>actions</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>action</key>\n\t\t\t<dict>\n\t\t\t\t<key>AMAccepts</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>Container</key>\n\t\t\t\t\t<string>List</string>\n\t\t\t\t\t<key>Optional</key>\n\t\t\t\t\t<true/>\n\t\t\t\t\t<key>Types</key>\n\t\t\t\t\t<array>\n\t\t\t\t\t\t<string>com.apple.applescript.object</string>\n\t\t\t\t\t</array>\n\t\t\t\t</dict>\n\t\t\t\t<key>AMActionVersion</key>\n\t\t\t\t<string>1.0.2</string>\n\t\t\t\t<key>AMApplication</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Automator</string>\n\t\t\t\t</array>\n\t\t\t\t<key>AMParameterProperties</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>source</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t</dict>\n\t\t\t\t<key>AMProvides</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>Container</key>\n\t\t\t\t\t<string>List</string>\n\t\t\t\t\t<key>Types</key>\n\t\t\t\t\t<array>\n\t\t\t\t\t\t<string>com.apple.applescript.object</string>\n\t\t\t\t\t</array>\n\t\t\t\t</dict>\n\t\t\t\t<key>ActionBundlePath</key>\n\t\t\t\t<string>/System/Library/Automator/Run AppleScript.action</string>\n\t\t\t\t<key>ActionName</key>\n\t\t\t\t<string>Run AppleScript</string>\n\t\t\t\t<key>ActionParameters</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>source</key>\n\t\t\t\t\t<string>-- Open in Marked 2\r-- Attempts to open the currently-edited document in Marked 2 for previewing\r-- By Brett Terpstra &lt;http://brettterpstra.com&gt;\r-- for Marked 2 &lt;http://marked2app.com&gt;\r-- Based on ideas by Lri &lt;https://gist.github.com/1077745&gt;\r-- with contributions from Donald Curtis &lt;https://github.com/milkypostman&gt;\r\ron run {}\r\ttell application \"System Events\"\r\t\tset frontApp to (name of first process whose frontmost is true)\r\tend tell\r\ttell application frontApp to activate\r\tset f to false\r\tset flist to {}\r\t\r\t--Marked (if Marked 2 is foreground, hide Marked 2 and end script)\r\tif frontApp is \"Marked 2\" then\r\t\ttell application \"System Events\" to set visible of process \"Marked 2\" to false\r\t\treturn\r\t\t--Notational Velocity/nvALT\r\telse if frontApp is \"Finder\" then\r\t\ttell application \"Finder\" to set flist to (get selection)\r\t\t-- Emacs?\r\telse if frontApp is \"Emacs\" then\r\t\tset emacsclient to false\r\t\ttell application \"Finder\"\r\t\t\tif exists POSIX file \"/usr/local/bin/emacsclient\" then\r\t\t\t\tset emacsclient to \"/usr/local/bin/emacsclient\"\r\t\t\tend if\r\t\tend tell\r\t\tif emacsclient is not false then\r\t\t\tset f to do shell script emacsclient &amp; \" -e '(first (delete nil (mapcar (function buffer-file-name) (buffer-list))))' | sed 's/^\\\"//' | sed 's/\\\"$//'\" as string\r\t\t\tif f is not \"nil\" then\r\t\t\t\tset f to f as POSIX file as alias\r\t\t\telse\r\t\t\t\tset f to false\r\t\t\tend if\r\t\tend if\r\t\t--Byword (open current document)\r\telse if frontApp is \"Byword\" then\r\t\ttell application frontApp to set f to file of document of window 1 as alias\r\telse if frontApp is \"TextEdit\" then\r\t\ttell application frontApp to set f to path of document of window 1 as POSIX file\r\telse if frontApp is \"Mou\" then\r\t\ttell application \"System Events\"\r\t\t\tset f to text 17 thru -1 of (value of attribute \"AXDocument\" of first window of process \"Mou\" as text)\r\t\tend tell\r\telse\r\t\ttell application \"System Events\"\r\t\t\ttell process frontApp\r\t\t\t\ttry\r\t\t\t\t\tset isScriptable to has scripting terminology\r\t\t\t\ton error\r\t\t\t\t\tset isScriptable to false\r\t\t\t\tend try\r\t\t\tend tell\r\t\tend tell\r\t\tif isScriptable then\r\t\t\ttry\r\t\t\t\ttell application frontApp to set f to POSIX file (path of document 1 of window 1) as alias\r\t\t\tend try\r\t\t\tif f is false then\r\t\t\t\ttry\r\t\t\t\t\ttell application frontApp to set f to POSIX file (path of first document) as alias\r\t\t\t\tend try\r\t\t\tend if\r\t\t\tif f is false then\r\t\t\t\ttry\r\t\t\t\t\ttell application frontApp to set f to POSIX file (text 17 thru -1 of (get URL of document 1)) as alias -- BBEdit\r\t\t\t\tend try\r\t\t\tend if\r\t\tend if\r\tend if\r\t\r\tif f is false and flist is not {} then\r\t\ttell application \"Marked 2\"\r\t\t\tactivate\r\t\t\trepeat with afile in flist\r\t\t\t\topen (afile as alias)\r\t\t\tend repeat\r\t\tend tell\r\telse if f is not false then\r\t\ttell application \"Marked 2\"\r\t\t\tactivate\r\t\t\topen f\r\t\tend tell\r\tend if\rend run</string>\n\t\t\t\t</dict>\n\t\t\t\t<key>BundleIdentifier</key>\n\t\t\t\t<string>com.apple.Automator.RunScript</string>\n\t\t\t\t<key>CFBundleVersion</key>\n\t\t\t\t<string>1.0.2</string>\n\t\t\t\t<key>CanShowSelectedItemsWhenRun</key>\n\t\t\t\t<false/>\n\t\t\t\t<key>CanShowWhenRun</key>\n\t\t\t\t<true/>\n\t\t\t\t<key>Category</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>AMCategoryUtilities</string>\n\t\t\t\t</array>\n\t\t\t\t<key>Class Name</key>\n\t\t\t\t<string>RunScriptAction</string>\n\t\t\t\t<key>InputUUID</key>\n\t\t\t\t<string>BF1A33C8-AC86-4E27-BCDF-032E82335A97</string>\n\t\t\t\t<key>Keywords</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Run</string>\n\t\t\t\t</array>\n\t\t\t\t<key>OutputUUID</key>\n\t\t\t\t<string>481CDC65-D777-4FBC-9404-11D2149BE37F</string>\n\t\t\t\t<key>UUID</key>\n\t\t\t\t<string>0D994D77-D1BA-48EB-82C3-F43CA91236E2</string>\n\t\t\t\t<key>UnlocalizedApplications</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Automator</string>\n\t\t\t\t</array>\n\t\t\t\t<key>arguments</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>0</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<string>on run {input, parameters}\n\t\n\t(* Your script goes here *)\n\t\n\treturn input\nend run</string>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>source</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t</dict>\n\t\t\t\t</dict>\n\t\t\t\t<key>isViewVisible</key>\n\t\t\t\t<true/>\n\t\t\t\t<key>location</key>\n\t\t\t\t<string>254.500000:554.000000</string>\n\t\t\t\t<key>nibPath</key>\n\t\t\t\t<string>/System/Library/Automator/Run AppleScript.action/Contents/Resources/English.lproj/main.nib</string>\n\t\t\t</dict>\n\t\t\t<key>isViewVisible</key>\n\t\t\t<true/>\n\t\t</dict>\n\t</array>\n\t<key>connectors</key>\n\t<dict/>\n\t<key>workflowMetaData</key>\n\t<dict>\n\t\t<key>serviceInputTypeIdentifier</key>\n\t\t<string>com.apple.Automator.nothing</string>\n\t\t<key>serviceOutputTypeIdentifier</key>\n\t\t<string>com.apple.Automator.nothing</string>\n\t\t<key>serviceProcessesInput</key>\n\t\t<integer>0</integer>\n\t\t<key>workflowTypeIdentifier</key>\n\t\t<string>com.apple.Automator.servicesMenu</string>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Services/Preview Selection in Marked.workflow/Contents/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSServices</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>NSMenuItem</key>\n\t\t\t<dict>\n\t\t\t\t<key>default</key>\n\t\t\t\t<string>Preview Selection in Marked</string>\n\t\t\t</dict>\n\t\t\t<key>NSMessage</key>\n\t\t\t<string>runWorkflowAsService</string>\n\t\t\t<key>NSSendTypes</key>\n\t\t\t<array>\n\t\t\t\t<string>public.utf8-plain-text</string>\n\t\t\t</array>\n\t\t</dict>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "Services/Preview Selection in Marked.workflow/Contents/document.wflow",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>AMApplicationBuild</key>\n\t<string>381</string>\n\t<key>AMApplicationVersion</key>\n\t<string>2.4</string>\n\t<key>AMDocumentVersion</key>\n\t<string>2</string>\n\t<key>actions</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>action</key>\n\t\t\t<dict>\n\t\t\t\t<key>AMAccepts</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>Container</key>\n\t\t\t\t\t<string>List</string>\n\t\t\t\t\t<key>Optional</key>\n\t\t\t\t\t<true/>\n\t\t\t\t\t<key>Types</key>\n\t\t\t\t\t<array>\n\t\t\t\t\t\t<string>com.apple.cocoa.string</string>\n\t\t\t\t\t</array>\n\t\t\t\t</dict>\n\t\t\t\t<key>AMActionVersion</key>\n\t\t\t\t<string>2.0.3</string>\n\t\t\t\t<key>AMApplication</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Automator</string>\n\t\t\t\t</array>\n\t\t\t\t<key>AMParameterProperties</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>COMMAND_STRING</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t\t<key>CheckedForUserDefaultShell</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t\t<key>inputMethod</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t\t<key>shell</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t\t<key>source</key>\n\t\t\t\t\t<dict/>\n\t\t\t\t</dict>\n\t\t\t\t<key>AMProvides</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>Container</key>\n\t\t\t\t\t<string>List</string>\n\t\t\t\t\t<key>Types</key>\n\t\t\t\t\t<array>\n\t\t\t\t\t\t<string>com.apple.cocoa.string</string>\n\t\t\t\t\t</array>\n\t\t\t\t</dict>\n\t\t\t\t<key>ActionBundlePath</key>\n\t\t\t\t<string>/System/Library/Automator/Run Shell Script.action</string>\n\t\t\t\t<key>ActionName</key>\n\t\t\t\t<string>Run Shell Script</string>\n\t\t\t\t<key>ActionParameters</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>COMMAND_STRING</key>\n\t\t\t\t\t<string>TMPFILE=`mktemp -t marked2-preview`\ncat &gt; $TMPFILE\nopen -a \"Marked 2.app\" $TMPFILE\nosascript -e 'tell application \"Marked 2\" to activate'</string>\n\t\t\t\t\t<key>CheckedForUserDefaultShell</key>\n\t\t\t\t\t<true/>\n\t\t\t\t\t<key>inputMethod</key>\n\t\t\t\t\t<integer>0</integer>\n\t\t\t\t\t<key>shell</key>\n\t\t\t\t\t<string>/bin/bash</string>\n\t\t\t\t\t<key>source</key>\n\t\t\t\t\t<string></string>\n\t\t\t\t</dict>\n\t\t\t\t<key>BundleIdentifier</key>\n\t\t\t\t<string>com.apple.RunShellScript</string>\n\t\t\t\t<key>CFBundleVersion</key>\n\t\t\t\t<string>2.0.3</string>\n\t\t\t\t<key>CanShowSelectedItemsWhenRun</key>\n\t\t\t\t<false/>\n\t\t\t\t<key>CanShowWhenRun</key>\n\t\t\t\t<true/>\n\t\t\t\t<key>Category</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>AMCategoryUtilities</string>\n\t\t\t\t</array>\n\t\t\t\t<key>Class Name</key>\n\t\t\t\t<string>RunShellScriptAction</string>\n\t\t\t\t<key>InputUUID</key>\n\t\t\t\t<string>4387D534-C179-4BE5-8868-B44C596823B0</string>\n\t\t\t\t<key>Keywords</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Shell</string>\n\t\t\t\t\t<string>Script</string>\n\t\t\t\t\t<string>Command</string>\n\t\t\t\t\t<string>Run</string>\n\t\t\t\t\t<string>Unix</string>\n\t\t\t\t</array>\n\t\t\t\t<key>OutputUUID</key>\n\t\t\t\t<string>DC0483B4-0CD6-406B-A0C5-7AF3BE520A5C</string>\n\t\t\t\t<key>UUID</key>\n\t\t\t\t<string>B11DCC37-6B60-490A-9CC5-B1FCD08F7A85</string>\n\t\t\t\t<key>UnlocalizedApplications</key>\n\t\t\t\t<array>\n\t\t\t\t\t<string>Automator</string>\n\t\t\t\t</array>\n\t\t\t\t<key>arguments</key>\n\t\t\t\t<dict>\n\t\t\t\t\t<key>0</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<integer>0</integer>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>inputMethod</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t</dict>\n\t\t\t\t\t<key>1</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<string></string>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>source</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>1</string>\n\t\t\t\t\t</dict>\n\t\t\t\t\t<key>2</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<false/>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>CheckedForUserDefaultShell</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>2</string>\n\t\t\t\t\t</dict>\n\t\t\t\t\t<key>3</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<string></string>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>COMMAND_STRING</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>3</string>\n\t\t\t\t\t</dict>\n\t\t\t\t\t<key>4</key>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>default value</key>\n\t\t\t\t\t\t<string>/bin/sh</string>\n\t\t\t\t\t\t<key>name</key>\n\t\t\t\t\t\t<string>shell</string>\n\t\t\t\t\t\t<key>required</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>type</key>\n\t\t\t\t\t\t<string>0</string>\n\t\t\t\t\t\t<key>uuid</key>\n\t\t\t\t\t\t<string>4</string>\n\t\t\t\t\t</dict>\n\t\t\t\t</dict>\n\t\t\t\t<key>isViewVisible</key>\n\t\t\t\t<true/>\n\t\t\t\t<key>location</key>\n\t\t\t\t<string>254.500000:554.000000</string>\n\t\t\t\t<key>nibPath</key>\n\t\t\t\t<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>\n\t\t\t</dict>\n\t\t\t<key>isViewVisible</key>\n\t\t\t<true/>\n\t\t</dict>\n\t</array>\n\t<key>connectors</key>\n\t<dict/>\n\t<key>workflowMetaData</key>\n\t<dict>\n\t\t<key>serviceInputTypeIdentifier</key>\n\t\t<string>com.apple.Automator.text</string>\n\t\t<key>serviceOutputTypeIdentifier</key>\n\t\t<string>com.apple.Automator.nothing</string>\n\t\t<key>serviceProcessesInput</key>\n\t\t<integer>0</integer>\n\t\t<key>workflowTypeIdentifier</key>\n\t\t<string>com.apple.Automator.servicesMenu</string>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sublime/Marked 2.sublime-build",
    "content": "{\n\t\"cmd\": [\"open\",\"-a\",\"/Applications/Marked 2.app\",\"$file\"],\n\t\"selector\": \"text.html.markdown\"\n}"
  },
  {
    "path": "TextMate/Marked 2.tmbundle/Commands/Open in Marked 2.tmCommand",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>beforeRunningCommand</key>\n\t<string>nop</string>\n\t<key>command</key>\n\t<string>#!/usr/bin/env bash\n[[ -f \"${TM_SUPPORT_PATH}/lib/bash_init.sh\" ]] &amp;&amp; . \"${TM_SUPPORT_PATH}/lib/bash_init.sh\"\n\nopen -a \"Marked 2.app\" \"$TM_FILEPATH\"\nosascript -e 'tell application \"Marked 2\" to activate'\n</string>\n\t<key>input</key>\n\t<string>none</string>\n\t<key>inputFormat</key>\n\t<string>text</string>\n\t<key>keyEquivalent</key>\n\t<string>^~m</string>\n\t<key>name</key>\n\t<string>Open in Marked 2</string>\n\t<key>outputCaret</key>\n\t<string>afterOutput</string>\n\t<key>outputFormat</key>\n\t<string>text</string>\n\t<key>outputLocation</key>\n\t<string>discard</string>\n\t<key>scope</key>\n\t<string>text.html.markdown, text.html.markdown.multimarkdown, text.html</string>\n\t<key>uuid</key>\n\t<string>74F0D07D-C2F7-4CDC-B08B-25024657AAF4</string>\n\t<key>version</key>\n\t<integer>2</integer>\n</dict>\n</plist>\n"
  },
  {
    "path": "TextMate/Marked 2.tmbundle/Commands/Preview Selection in Marked 2.tmCommand",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>beforeRunningCommand</key>\n\t<string>saveActiveFile</string>\n\t<key>command</key>\n\t<string>#!/usr/bin/env bash\n[[ -f \"${TM_SUPPORT_PATH}/lib/bash_init.sh\" ]] &amp;&amp; . \"${TM_SUPPORT_PATH}/lib/bash_init.sh\"\n\nTMPFILE=`mktemp -t marked2-preview`\ncat &gt; $TMPFILE\nopen -a \"Marked 2.app\" $TMPFILE\nosascript -e 'tell application \"Marked 2\" to activate'</string>\n\t<key>input</key>\n\t<string>selection</string>\n\t<key>inputFormat</key>\n\t<string>text</string>\n\t<key>keyEquivalent</key>\n\t<string>^~m</string>\n\t<key>name</key>\n\t<string>Preview Selection in Marked 2</string>\n\t<key>outputCaret</key>\n\t<string>afterOutput</string>\n\t<key>outputFormat</key>\n\t<string>text</string>\n\t<key>outputLocation</key>\n\t<string>discard</string>\n\t<key>scope</key>\n\t<string>text.html.markdown, text.html.markdown.multimarkdown, text.html</string>\n\t<key>uuid</key>\n\t<string>F0BD6911-FCB2-4B6B-AE72-19DB9F3F86D6</string>\n\t<key>version</key>\n\t<integer>2</integer>\n</dict>\n</plist>\n"
  },
  {
    "path": "TextMate/Marked 2.tmbundle/Commands/Strip Header IDs.tmCommand",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>beforeRunningCommand</key>\n\t<string>nop</string>\n\t<key>command</key>\n\t<string>#!/usr/bin/env ruby18 -wKU\ninput = STDIN.read\nputs input.gsub(/(h\\d) id=\".*?\"/,\"\\\\1\")\n</string>\n\t<key>input</key>\n\t<string>document</string>\n\t<key>inputFormat</key>\n\t<string>text</string>\n\t<key>name</key>\n\t<string>Strip Header IDs</string>\n\t<key>outputCaret</key>\n\t<string>heuristic</string>\n\t<key>outputFormat</key>\n\t<string>text</string>\n\t<key>outputLocation</key>\n\t<string>replaceInput</string>\n\t<key>scope</key>\n\t<string>text.html</string>\n\t<key>uuid</key>\n\t<string>E66EE61A-0D66-44B0-899E-DA4DD9D1E20F</string>\n\t<key>version</key>\n\t<integer>2</integer>\n</dict>\n</plist>\n"
  },
  {
    "path": "TextMate/Marked 2.tmbundle/info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>contactEmailRot13</key>\n\t<string>wnerq@xbgsh.arg</string>\n\t<key>contactName</key>\n\t<string>Jared Crapo</string>\n\t<key>description</key>\n\t<string>Preview markdown in [Marked 2](http://marked2app.com).</string>\n\t<key>name</key>\n\t<string>Marked 2</string>\n\t<key>uuid</key>\n\t<string>98FC9536-43B0-4A09-873E-DD7ED25C291B</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Watchers/everwatch.rb",
    "content": "#!/usr/bin/env ruby\n# everwatch.rb by Brett Terpstra, 2011\n# Watch Evernote for updates and put the current content of the editor into a preview file for Marked.app\n# <http://markedapp.com>\n\ntrap(\"SIGINT\") { exit }\n\nwatch_folder = File.expand_path(\"~/Library/Application Support/Evernote/data\")\nif not File.directory?(watch_folder)\n  # evernote from the app store uses a different path\n  # because of the sandbox rules\n  app_folder = File.expand_path(\"~/Library/Application Support/com.evernote.Evernote/accounts/www.evernote.com\")\n  # inside app_folder, there is a folder with your evernote user id. If you\n  # have multiple evernote user id's this will probably break, but most\n  # people don't, so we should be good \n  watch_folder = Dir.glob(\"#{app_folder}/*\").first\nend\nmarked_note = File.expand_path(\"~/Marked Preview.md\")\ncounter = 0\n\nwhile true do # repeat infinitely\n  \n  # read a list of files from the autosave folder\n  files = Dir.glob( File.join( watch_folder, \"*\") )\n  # build a hash of timestamps\n\n  new_hash = files.collect {|f| [ f, File.stat(f).mtime.to_i ] }\n  hash ||= new_hash\n  # check for timestamp changes since the last loop\n  diff_hash = new_hash - hash\n\n  if diff_hash.empty? # if there's no change\n    # if it's been less than 10 seconds, increment the counter\n    # otherwise, set it to zero and wait for new changes\n    counter = (counter < 10 && counter > 0) ? counter + 1 : 0\n  else\n    # store the new hash and start the 10 second change timer at 1\n    hash = new_hash\n    counter = 1\n  end\n\n  if counter > 0 # if the time is running\n    # get the contents of the post and continued editor screens\n    note = %x{ osascript <<APPLESCRIPT\n        tell application \"Evernote\"\n            if selection is not {} then\n                set the_selection to selection\n                return HTML content of item 1 of the_selection\n            else\n                return \"\"\n            end if\n        end tell\nAPPLESCRIPT}\n    unless note == '' # if we got something back from the AppleScript\n      # convert the contents to plain text\n      txtnote = %x{echo '<html><body>#{note}</body></html>'|textutil -stdin -convert txt -stdout}\n      # write the contents to the preview file\n      watch_note = File.new(\"#{marked_note}\",'w')\n      watch_note.puts txtnote\n      watch_note.close\n    end\n    # sleep an extra second on changes because Marked only\n    # reads changes every 2 seconds\n    sleep 1 \n  end\n    \n  sleep 1\n\nend"
  },
  {
    "path": "Watchers/nvwatch.rb",
    "content": "#!/usr/bin/env ruby\n# watch.rb by Brett Terpstra, 2011\n# Watch Notational Velocity notes folder for changes and \n# update a preview file for Marked with most recently-modified file contents\n# Requres that notes be stored as plain text and notes folder be customized below\n\ntrap(\"SIGINT\") { exit }\n\nwatch_folder = \"/Users/ttscoff/Dropbox/Notes/nvALT2.1\"\nwatch_types = ['txt','md']\nmarked_note = File.expand_path(\"~/Marked Preview.md\")\n\nwhile true do # repeat infinitely\n  files = []\n  watch_types.each {|type|\n    files += Dir.glob( File.join( watch_folder, \"**\", \"*.#{type}\" ) )\n  } # collect a list of files of specified type\n  new_hash = files.collect {|f| [ f, File.stat(f).mtime.to_i ] } # create a hash of timestamps\n  hash ||= new_hash\n  diff_hash = new_hash - hash # check for changes\n  \n  unless diff_hash.empty? # if changes were found in the timestamps\n    hash = new_hash\n    puts \"changed\"\n    note_file = File.new(\"#{diff_hash[0][0]}\",'r') # read the latest changed file from the hash\n    note = note_file.read\n    note_file.close\n    watch_note = File.new(\"#{marked_note}\",'w') # write its contents to the preview file\n    watch_note.puts note\n    watch_note.close\n  end\n  \n  sleep 1\nend"
  },
  {
    "path": "iAWriter/Open in Marked.applescript",
    "content": "-- Preview the currently active iA Writer document using Marked.\ntell application \"iA Writer\"\n  activate\n\t\n\t-- Ask iA Writer for it's active document.\n\tset the_document to document 1\n\t\n\t-- Save the document or prompt if not previously saved.\n\tsave the_document\n\t\n\t-- If the file is saved, open it using Marked.\n\ttell application \"Marked\"\n\t\tset the_file to the_document's file\n\t\topen the_file\n\t\t-- Bring Marked forward so it becomes visible.\n\t\tactivate\n\tend tell\n\nend tell"
  },
  {
    "path": "install",
    "content": "#! /usr/bin/env bash\n\nservices() {\n    cp -r Services/* $HOME/Library/Services\n}\n\nbbedit() {\n    BBEDIT_DIR=\"$HOME/Library/Application Support/BBEdit/Scripts/\"\n    mkdir -p \"$BBEDIT_DIR\"\n    cp \"BBEdit/Open in Marked.applescript\" \"$BBEDIT_DIR\"\n}\n\nst2() {\n    ST2_DIR=\"$HOME/Library/Application Support/Sublime Text 2/Packages/User\"\n    mkdir -p \"$ST2_DIR\"\n    cp \"Sublime/Marked 2.sublime-build\" \"$ST2_DIR\"\n}\n\nst3() {\n    ST3_DIR=\"$HOME/Library/Application Support/Sublime Text 3/Packages/User\"\n    mkdir -p \"$ST3_DIR\"\n    cp \"Sublime/Marked 2.sublime-build\" \"$ST3_DIR\"\n}\n\niawriter() {\n    IAWRITER_DIR=\"$HOME/Library/Scripts/Applications/iA Writer/\"\n    mkdir -p \"$IAWRITER_DIR\"\n    cp \"iAWriter/Open in Marked.applescript\" \"$IAWRITER_DIR\"\n}\n\n# TODO:\n#   Add vim support.\n#   Add emacs support.\n\nif [[ -z $@ ]]\nthen\n    cat << EOF\nThis scriptlet automates installing *some* elements of the Marked\nbonus pack. It currently supports the targets listed below, using the\ncorresponding keywords:\n\n    Target            Keyword\n    --------------    --------\n    Services          services\n    BBEdit.           bbedit\n    Sublime Text 2    st2\n    Sublime Text 3    st3\n    iA Writer.        iawriter\n\nInvoke it with one or more of the keywords as arguments, e.g.\n\n    ./install services st3\nEOF\nelse\n    for i in $@\n    do\n        echo \"Installing $i\"\n        $i\n    done\nfi\n"
  }
]