compdoc-0.2.0.0: Parse a Pandoc to a composite value.
LicenseMIT
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Text.Compdoc

Description

Provides functionality for transforming a Pandoc into a composite record.

Synopsis

Documentation

type FContent = (:->) "content" Text Source #

fContent :: forall f rs. (Functor f, (∈) FContent rs) => (Text -> f Text) -> Record rs -> f (Record rs) Source #

type Compdoc a = FContent ': a Source #

A Compdoc is a Record with at least an FContent field.

readMarkdown' :: (Show e, Typeable e, MonadThrow m) => ReaderOptions -> WriterOptions -> JsonFormat e (Record a) -> Text -> m (Record (Compdoc a)) Source #

Read some Pandoc markdown as Text as a `Record (Compdoc a)` supplying a JsonFormat for the metadata.

readMarkdownFile :: (MonadIO m, MonadThrow m, Show e, Typeable e) => ReaderOptions -> WriterOptions -> JsonFormat e (Record a) -> Path b File -> m (Record (Compdoc a)) Source #

Read a markdown file from disk, supplying a JsonFormat for the metadata.

runPandocPureDefault :: a -> PandocPure a -> a Source #

Run a PandocPure operation with a default value in the event of failure.

pandocToCompdoc :: (Typeable e, Show e, MonadThrow m) => (WriterOptions -> Pandoc -> PandocPure Text) -> WriterOptions -> JsonFormat e (Record a) -> Pandoc -> m (Record (Compdoc a)) Source #

Transform a Pandoc to a Compdoc supplying a `JsonFormat for the metadata.

contentBlock :: WriterOptions -> [Block] -> Record (FContent ': '[]) Source #

Create the tail of a Compdoc which is just an FContent field.

writeBlocksDefault :: WriterOptions -> [Block] -> Text Source #

Write a list of Blocks to Text using WriterOptions defaulting to the empty string in the case of error.

flattenMeta :: MonadThrow m => (Pandoc -> PandocPure Text) -> Meta -> m Value Source #

Flatten pandoc metadata to an aeson value.