Markdown Preview Service

With the help of ThisService and my very rudimentary ahem knowledge of Perl, I’ve tossed together a simple Application Service, that generates a preview for Markdown in Quicklook. Yes, you’ve read right: It’s not MMD, just plain old Markdown. Use at YOUR OWN RISK.

Download: QuicklookMarkdown.service.zip (unzip and install in ~/Library/Services/ )

You will also need the Markdown Quicklook plugin.

qlmk.png

Here’s the script. I’d love to improve this, so if you have any suggestions, please let me know :smiley:

#!/usr/bin/perl -w -CIO use strict; use open ':encoding(utf8)'; my $input; { undef $/; $input = <STDIN>; } my $filename = "/tmp/_tmp_mmdout987.md"; $input =~ s/\r/\n/g; open(OUTFILE, ">$filename") or die "Can't open input file: $!"; print OUTFILE $input; print OUTFILE "\n"; close (OUTFILE) or die; system "qlmanage -p /tmp/_tmp_mmdout987.md >& /dev/null &";

A new version that uses MultiMarkdown and the default web browser. MMD must be installed in the search path for the script to work.