Those cute little text formats are all the rage now, especially Markdown and reStructuredText. You can write them pretty easily, without lots of markup boilerplate that HTML entails, so they increasingly rule the READMEs of various open source projects. Both GitHub and Bitbucket support them perfectly well for this purpose.
They are obviously not WYSIWYG, though, so you may want to check the formatting first, before showing your prose to the rest of the world. There are some standard HTML generators for each of those text formats, but it would be more convenient to have one tool to rule them all…
And so there is Pandoc. That nifty utility is capable of converting from many input text formats into a vast variety of output formats, including HTML and PDF. It can be installed very easily on most systems:
and downloadable installers are available for OS X and Windows.
pandoc is a well behaved command line program, so it can accept both files and standard input, enabling it to be used in shell pipelines. Unfortunately, browser executables are not so cooperative – they generally want files, not just streams of data. We can circumvent that with the use of
/tmp directory and a little bit of shell scripting:
This should work
chrome, and likely with any other browser.
Next step? Maybe deploy a file system watcher, hook it up with some browser instrumentation, and make the page reload whenever a change in the source is detected. Non-trivial, but definitely doable :)
less geeky solution – use mou – http://mouapp.com/ ;)
Explicit use of temporary file looks here really ugly…
Zsh obviously has better syntax for that ;)
$BROWSER =(pandoc $FILE)
@Xender: That’s great! Yet another nifty zsh trick I had no idea of :)
@viroos: Too bad it only supports Markdown and one, niche operating system ;P