Marked gives you full control.
Using a custom processor
You can specify a custom Markdown processor in the Behavior section of the Preferences. Enter a UNIX path to an executable or script which can take input on STDIN and return output on STDOUT and it will be used for Preview, Source, Print and Save operations. This can, for example, allow Maruku or Kramdown to be used instead of MultiMarkdown, or even incorporate Textile and other markup languages into Marked.
Marked sets an environment variable for the current working directory (
PWD) to the location of the file currently being previewed. You can use this to change the working directory of a script and include files with relative paths to the current document. As an example, in Ruby you can use:
When enabled, the custom processor can be turned on and off for individual documents using Command-Option-C.
Marked runs the custom processor in its own shell, meaning standard environment variables are not automatically passed. You can use Marked’s environment variables to augment your own in your scripts. Marked makes the following variables available for use in your shell scripts:
- The current location (base directory) of your primary working file (the folder of the working text, Scrivener or index file).
- Marked sets a path which includes default executable folders and appends the directory in the PWD above. The defaults are:
/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin. You can add your own by setting the PATH variable as needed and appending or overwriting Marked’s path (e.g. PATH=/usr/local/yourfolder:$PATH).
- The home directory of the current user. Python and other scripts which rely on the HOME variable being set will pick this up automatically, but it’s available for other uses in your scripts.
- The extension of the primary file being processed. This variable allows you to script different processes based on the type of file being viewed. For example, if $MARKED_EXT == “md” run your preferred Markdown processor, but if $MARKED_EXT == “textile” run a Textile processor.
- This is the full UNIX path to the main file open in Marked when the processor is run.
- A quoted, comma-separated list of the files Marked has included in the text being passed using the various include syntaxes.
Using Textile as your markup language
A few people have asked how to get Textile working in Marked. You need to have a Textile converter available from the command line. There are a few options, including Pandoc, but the two easiest I’ve found are RedCloth for Ruby and Textile for Perl (requires that the Developer Tools be installed). Install one or the other:
- Install Textile from https://github.com/bradchoate/text-textile OR
sudo gem installRedCloth in Terminal.
- Set your preferences like above for the Perl version. Use
Note: your install paths may differ. You can determine the correct path using
which textile or
which redcloth in the Terminal.
Now Marked is a Textile previewer for you!