Created
August 17, 2011 16:27
-
-
Save jcromartie/1151940 to your computer and use it in GitHub Desktop.
Markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns util.markdown | |
(import (java.io | |
BufferedReader | |
InputStreamReader))) | |
(defn markdown | |
[s] | |
(let [builder (java.lang.ProcessBuilder. ["Markdown.pl"]) | |
proc (.start builder) | |
stdin (.getOutputStream proc) | |
reader (BufferedReader. (InputStreamReader. (.getInputStream proc))) | |
bytes (.getBytes s)] | |
(do | |
(.write stdin bytes 0 (alength bytes)) | |
(.flush stdin) | |
(.close stdin) | |
(apply str (interpose "\n" (line-seq reader)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment