| Copyright | (c) Chris Penner 2019 |
|---|---|
| License | BSD3 |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Slick.Pandoc
Description
Synopsis
- markdownToHTML :: Text -> Action Value
- markdownToHTML' :: FromJSON a => Text -> Action a
- markdownToHTMLWithOpts :: ReaderOptions -> WriterOptions -> Text -> Action Value
- markdownToHTMLWithOpts' :: FromJSON a => ReaderOptions -> WriterOptions -> Text -> Action a
- orgModeToHTML :: Text -> Action Value
- orgModeToHTML' :: FromJSON a => Text -> Action a
- orgModeToHTMLWithOpts :: ReaderOptions -> WriterOptions -> Text -> Action Value
- orgModeToHTMLWithOpts' :: FromJSON a => ReaderOptions -> WriterOptions -> Text -> Action a
- makePandocReader :: PandocReader textType -> textType -> Action (Pandoc, Value)
- makePandocReader' :: FromJSON a => PandocReader textType -> textType -> Action (Pandoc, a)
- makePandocReaderWithMetaWriter :: PandocReader textType -> PandocWriter -> textType -> Action (Pandoc, Value)
- makePandocReaderWithMetaWriter' :: FromJSON a => PandocReader textType -> PandocWriter -> textType -> Action (Pandoc, a)
- type PandocReader textType = textType -> PandocIO Pandoc
- type PandocWriter = Pandoc -> PandocIO Text
- loadUsing :: PandocReader textType -> PandocWriter -> textType -> Action Value
- loadUsing' :: FromJSON a => PandocReader textType -> PandocWriter -> textType -> Action a
- loadUsingMeta :: PandocReader textType -> PandocWriter -> PandocWriter -> textType -> Action Value
- defaultMarkdownOptions :: ReaderOptions
- defaultOrgModeOptions :: ReaderOptions
- defaultHtml5Options :: WriterOptions
- convert :: (FromJSON a, ToJSON a, FromJSON b) => a -> Action b
- flattenMeta :: PandocWriter -> Meta -> Action Value
Documentation
markdownToHTML' :: FromJSON a => Text -> Action a Source #
Like markdownToHTML but allows returning any JSON serializable object
markdownToHTMLWithOpts Source #
Arguments
| :: ReaderOptions | Pandoc reader options to specify extensions or other functionality |
| -> WriterOptions | Pandoc writer options to modify output |
| -> Text | Text for conversion |
| -> Action Value |
Like markdownToHTML but allows providing additional pandoc reader and writer options
markdownToHTMLWithOpts' Source #
Arguments
| :: FromJSON a | |
| => ReaderOptions | Pandoc reader options to specify extensions or other functionality |
| -> WriterOptions | Pandoc writer options to modify output |
| -> Text | Text for conversion |
| -> Action a |
Like markdownToHTMLWithOpts but returns any JSON serializable object.
orgModeToHTML' :: FromJSON a => Text -> Action a Source #
Like orgModeToHTML but allows returning any JSON compatible object.
orgModeToHTMLWithOpts Source #
Arguments
| :: ReaderOptions | Pandoc reader options to specify extensions or other functionality |
| -> WriterOptions | Pandoc writer options to modify output |
| -> Text | Text for conversion |
| -> Action Value |
Like orgModeToHTML but allows providing additional pandoc reader and writer options
orgModeToHTMLWithOpts' Source #
Arguments
| :: FromJSON a | |
| => ReaderOptions | Pandoc reader options to specify extensions or other functionality |
| -> WriterOptions | Pandoc writer options to modify output |
| -> Text | Text for conversion |
| -> Action a |
Like orgModeToHTMLWithOpts but allows returning any JSON compatible object
makePandocReader :: PandocReader textType -> textType -> Action (Pandoc, Value) Source #
Given a reader from Readers this creates a loader which
given the source document will read its metadata into a Value
returning both the Pandoc object and the metadata within an Action.
The metadata values will be read as Markdown but rendered as plain text,
removing any links, pictures, and inline formatting.
makePandocReader' :: FromJSON a => PandocReader textType -> textType -> Action (Pandoc, a) Source #
Like makePandocReader but will deserialize the metadata
into any object which implements FromJSON. Failure to deserialize will
fail the Shake build. Metadata values will be read as Markdown but
rendered as plain text, removing any links, pictures, and inline
formatting.
makePandocReaderWithMetaWriter :: PandocReader textType -> PandocWriter -> textType -> Action (Pandoc, Value) Source #
makePandocReaderWithMetaWriter' :: FromJSON a => PandocReader textType -> PandocWriter -> textType -> Action (Pandoc, a) Source #
Like makePandocReaderWithMetaWriter but will deserialize the metadata
into any object which implements FromJSON. Failure to deserialize will
fail the Shake build.
type PandocReader textType = textType -> PandocIO Pandoc Source #
loadUsing :: PandocReader textType -> PandocWriter -> textType -> Action Value Source #
Load in a source document using the given PandocReader, then render the Pandoc
into text using the given PandocWriter.
Returns a Value wherein the rendered text is set to the "content" key and
any metadata is set to its respective key in the Value
loadUsing' :: FromJSON a => PandocReader textType -> PandocWriter -> textType -> Action a Source #
Arguments
| :: PandocReader textType | The reader used to load the document |
| -> PandocWriter | The writer used to render the document itself |
| -> PandocWriter | The writer used to process metadata. |
| -> textType | |
| -> Action Value |
Load in a source document using the given PandocReader, then render the Pandoc
into text using the given PandocWriter. Takes a second PandocWriter to render
metadata.
Returns a Value wherein the rendered text is set to the "content" key and
any metadata is set to its respective key in the Value
defaultMarkdownOptions :: ReaderOptions Source #
Reasonable options for reading a markdown file. Behaves similar to Github Flavoured Markdown
defaultOrgModeOptions :: ReaderOptions Source #
Reasonable options for reading an org-mode file
defaultHtml5Options :: WriterOptions Source #
Reasonable options for rendering to HTML. Includes default code highlighting rules
convert :: (FromJSON a, ToJSON a, FromJSON b) => a -> Action b Source #
Attempt to convert between two JSON serializable objects (or Values).
Failure to deserialize fails the Shake build.
flattenMeta :: PandocWriter -> Meta -> Action Value Source #
Flatten a Pandoc Meta into a well-structured JSON object, rendering Pandoc
text objects into plain strings along the way.