Try using pandoc?

This commit is contained in:
Christine Dodrill 2015-07-28 09:50:07 -07:00
parent e255e6672e
commit 99567b586b
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import Database.SQLite.Simple.FromRow
import Text.Blaze.Html5 ((!))
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Pandoc
data Post = Post
{ id :: Int
@ -26,4 +27,9 @@ render post = do
H.div ! A.class_ "card blue-grey darken-1" $ do
H.div ! A.class_ "card-content white-text" $ do
H.span ! A.class_ "card-title" $ H.toHtml $ unpack (author post)
H.p $ H.toHtml $ unpack (markdown post)
state <- case readTextile def (unpack $ body post) of
Right v -> return v
Left err -> error (show err)
H.p $ writeHtml def state

View File

@ -65,6 +65,8 @@ executable time-wasting-thread-memorial
, blaze-markup >=0.7.0.2
, wai-middleware-static >=0.7.0.1
, wai-extra >=1.3.0
, pandoc >=1.15.0.6
, mtl >=2.2.1
-- Directories containing source files.
hs-source-dirs: src