Previewing Markdown Documents
When you are writing a Markdown document (perhaps a README.md for a new gem), you may wish to preview what the rendered document will look like. One cumbersome option is to push your branch to Github periodically, so you can view the rendered version online.
Here is a bash function that will allow for a faster workflow:
mdp() {
local tmpfile='/tmp/markdown-preview.html';
local srcfile=$1;
perl ~/bin/Markdown.pl --html4tags $srcfile > $tmpfile;
open $tmpfile;
}
You can put this in your .bash_profile and then run mdp README.md
to instantly preview your document in a new browser window.
Requirements:
Download Markdown.pl from http://daringfireball.net/projects/markdown/ and put it in your ~/bin/ directory (or elsewhere, and update the function to aim correctly at it.)
Caveats:
No syntax highlighting or other Github Flavored Markdown-specific niceties.
Written by Matt Gillooly
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#