rib-0.2.0.0

Safe HaskellNone
LanguageHaskell2010

Rib.Pandoc

Contents

Description

Helpers for working with Pandoc documents

Synopsis

Parsing

parse Source #

Arguments

:: (ReaderOptions -> Text -> PandocIO Pandoc)

Document format. Example: readMarkdown

-> Text

Source text to parse

-> IO Pandoc 

Parse the source text as a Pandoc document

Supports the includeCode extension.

Converting to HTML

render :: Pandoc -> Html () Source #

Render a Pandoc document as Lucid HTML

renderInlines :: [Inline] -> Html () Source #

Render a list of Pandoc Inline values as Lucid HTML

Useful when working with Meta values from the document metadata.

Metadata

getMeta :: IsMetaValue a => String -> Pandoc -> Maybe a Source #

Get the metadata value for the given key in a Pandoc document.

It is recommended to call this function with type application specifying the type of a.

MetaValue is parsed in accordance with the IsMetaValue class constraint. Available instances:

  • Html: parse value as a Pandoc document and convert to Lucid Html
  • Text: parse a raw value (Inline with one Str value)
  • [a]: parse a list of values
  • Read a => a: parse a raw value and then read it.

setMeta :: Show a => String -> a -> Pandoc -> Pandoc Source #

Add, or set, a metadata data key to the given Haskell value

parseMeta :: ByteString -> IO Meta Source #

Parse the metadata source as a Pandoc Meta value

Extracting information

getH1 :: Pandoc -> Maybe (Html ()) Source #

Get the top-level heading as Lucid HTML

getFirstImg Source #

Arguments

:: Pandoc 
-> Maybe Text

Relative URL path to the image

Get the first image in the document if one exists