Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created August 17, 2011 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcromartie/1151940 to your computer and use it in GitHub Desktop.
Save jcromartie/1151940 to your computer and use it in GitHub Desktop.
Markdown
(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