Markdown generation for Clojure and ClojureScript.
(require '[marge.core :as marge])
(marge/markdown
[:h4 "My Heading"])
(marge/markdown
[:blockquote "Something quote worthy!"])
Something quote worthy!
(marge/markdown
[:normal "Done this!"])
Done this!
(marge/markdown
[:strikethrough "Done this!"])
Done this!
(marge/markdown
[:strong "Done this!"])
Done this!
(marge/markdown
[:em "Done this!"])
Done this!
(marge/markdown
[:ol ["Item 1" "Item 2"]])
- Item 1
- Item 2
(marge/markdown
[:ul ["Item 1" "Item 2"]])
- Item 1
- Item 2
(marge/markdown
[:ol ["Item 1"
[:ul "Sub Item 1" "Sub Item 2"]
"Item 2"]])
- Item 1
- Sub Item 1
- Sub Item 2
- Item 2
(marge/markdown
[:ul [{:done? true :task "Item 1"} {:done? false :task "Item 2"}]])
- Item 1
- Item 2
(marge/markdown
[:link
{:text "I'm an inline-style link"
:title "Google Homepage"
:url "https://www.google.com"}])
Sometimes you might want to place an anchor that you link to later.
(marge/markdown
[:anchor "Anchor"])
(marge/markdown
[:hr])
(marge/markdown
[:code
{:clojure "(def data [1 2 3])"}])
(def data [1 2 3])
(markdown
[:table
["Product"
["Coke" "Fanta" "Lilt"]
"Quantity"
["100" "10000000" "1"]
"Price"
["$70" "$7000000" "$2"]]])
Product | Quantity | Price |
---|---|---|
Coke | 100 | $70 |
Fanta | 10000000 | $7000000 |
Lilt | 1 | $2 |
(markdown
[:table
["Title"
["link"]
"Links"
[:link {:url "url" :text "text"}]]])
Title | Links |
---|---|
link | text |
You can generate html inside your markdown using Hiccup syntax, the rendering for this uses Hiccup for Clojure or Hiccups for ClojureScript.
(markdown [:p
[:normal "When I want to search for things I go to "
:html [:a {:href "http://google.com"} "google"]]])
When I want to search for things I go to google
(markdown [:p
[:normal "When I want to search for things I go to "
:em [:link {:url "http://google.com" :text "google"}]]])