packages feed

hyakko-0.3.2: src/Text/Markdown.hs

module Text.Markdown (toHTML) where

import Text.Pandoc ( readMarkdown
                   , writeHtmlString
                   , def
                   )

import Data.ByteString.Lazy.Char8 (ByteString, pack)

-- Function for translating Markdown to HTML since `Pandoc` has several
-- different generators for other markup languages.
toHTML :: String -> ByteString
toHTML = pack . writeHTMLStr . parse
  where parse = readMarkdown def
        writeHTMLStr = writeHtmlString def
{-# INLINE toHTML #-}