sitepipe-0.4.0.0: A simple to understand static site generator

Safe HaskellNone
LanguageHaskell2010

SitePipe.Readers

Contents

Synopsis

Built-in readers

markdownReader :: String -> IO String Source #

Reads markdown files into html

textReader :: String -> PandocIO String Source #

Reads text files without processing

Reader Generators

mkPandocReader :: (ReaderOptions -> String -> PandocIO Pandoc) -> String -> IO String Source #

Given any standard pandoc reader (see Text.Pandoc; e.g. readMarkdown, readDocX) makes a resource reader compatible with resourceLoader.

docs <- resourceLoader (mkPandocReader readDocX) ["docs/*.docx"]

mkPandocReaderWith :: (ReaderOptions -> String -> PandocIO Pandoc) -> (Pandoc -> PandocIO Pandoc) -> (Pandoc -> PandocIO String) -> String -> IO String Source #

Like mkPandocReader, but allows you to provide both a Pandoc -> Pandoc transformation, which is great for things like relativizing links or running transforms over specific document elements. See https://hackage.haskell.org/package/pandoc-lens for some useful tranformation helpers. You also specify the tranformation from Pandoc -> String which allows you to pick the output format of the reader. If you're unsure what to use in this slot, the pandocToHTML function is a good choice.

readMarkdown #

Arguments

:: PandocMonad m 
=> ReaderOptions

Reader options

-> Text

String to parse (assuming '\n' line endings)

-> m Pandoc 

Read markdown from an input string and return a Pandoc document.

Pandoc Writers

pandocToHTML :: Pandoc -> PandocIO String Source #

A simple helper which renders pandoc to HTML; good for use with mkPandocReaderWith