switched to PegDown directly

This commit is contained in:
Christian Mueller
2014-07-08 09:06:23 +02:00
parent 6557de2fdf
commit b47c013b28
4 changed files with 14 additions and 8 deletions
+1 -2
View File
@@ -6,7 +6,6 @@
[clojure.string :rename {replace sreplace} :only [replace]]
[clojure.core.incubator :only [-?>]])
(:require
[me.raynes.cegdown :as md]
[clojure.core.cache :as cache]
[hiccup.util :as util]
[compojure.handler :as handler]
@@ -49,7 +48,7 @@
(defroutes app-routes
(GET "/api" [] (layout :no-js (get-message :api-title)
[:article (md/to-html (slurp "API.md"))]))
[:article (md-to-html (slurp "API.md"))]))
(context "/api" []
#(ring.util.response/content-type (api-routes %) "application/json"))
+11 -5
View File
@@ -9,11 +9,17 @@
[hiccup.util :only [escape-html]]
[hiccup.page :only [include-js html5]])
(:require
[me.raynes.cegdown :as md]
[notehub.api :as api]))
[notehub.api :as api])
(:import (org.pegdown PegDownProcessor Extensions)))
(def get-message (get-map "messages"))
(def md-processor
(PegDownProcessor. Extensions/TABLES))
(defn md-to-html [md-text]
(.markdownToHtml md-processor md-text))
; Creates the main html layout
(defn layout
[js? title & content]
@@ -69,8 +75,8 @@
[:div#dashed-line]
[:article.helvetica.bottom-space
{:style "font-size: 1em"}
(md/to-html (slurp "LANDING.md"))]
[:div.centered.helvetica (md/to-html (get-message :footer))]))
(md-to-html (slurp "LANDING.md"))]
[:div.centered.helvetica (md-to-html (get-message :footer))]))
(defn statistics-page [resp]
@@ -104,7 +110,7 @@
(let [note (api/get-note {:noteID note-id})
sanitized-note (sanitize (:note note))]
(layout :no-js (:title note)
[:article.bottom-space (md/to-html sanitized-note)]
[:article.bottom-space (md-to-html sanitized-note)]
(let [urls {:short-url (api/url short-url)
:notehub "/"}
links (map #(link-to