yesod-markdown-0.0: Markdown processing for Yesod sites using Pandoc

Yesod.Markdown.Macros

Description

Macros allow users to access more advanced functionality from within Markdown syntax. There are two types of macros, block and inline, which allow substitution of Block and Inline data, respectively. Macros are called in a very similar fashion to shell programs: the argument string is split on whitespace. The first word is the name of the macro, and the remaining words are the arguments. Option-parsing libraries may be useful for interpreting the arguments.

Note: using blockMacros and inlineMacros at the same time with the same magic string and can lead to behavior that depends on the order in which they are called, if any of the macro names are the same for block and inline macros. However, if none of the macro names are the same, unrecognized macro names will be ignored by the pass that doesn't recognize them, leaving them available to be recognized by the other pass.

Synopsis

Documentation

blockMacrosSource

Arguments

:: Yesod master 
=> String

Magic string to introduce the macro

-> Map String ([String] -> GHandler sub master Block)

Lookup table from macro names to macro functions

-> Pandoc 
-> GHandler sub master Pandoc 

Convert block-level macros. Block-level macros are signalled by a first-level header containing a piece of inline code starting with a client-specified magic string. For example, if the magic string is ??, a macro can be called by

 #`??MACRO_NAME MACRO_ARGS`

where MACRO_NAME is the identifying name of the macro and MACRO_ARGS is a space-separated list of arguments.

inlineMacrosSource

Arguments

:: Yesod master 
=> String

Magic string to introduce the macro

-> Map String ([String] -> GHandler sub master Inline)

Lookup table from macro names to macro functions

-> Pandoc 
-> GHandler sub master Pandoc 

Convert block-level macros. Inline-level macros are signalled by a piece of inline code starting with a client-specified magic string. For example, if the magic string is ??, a macro can be called by

 `??MACRO_NAME MACRO_ARGS`

where MACRO_NAME is the identifying name of the macro and MACRO_ARGS is a space-separated list of arguments.

hamletToBlock :: Hamlet (Route master) -> GHandler sub master BlockSource

Convert a Hamlet value to a Block.

hamletToInline :: Hamlet (Route master) -> GHandler sub master InlineSource

Convert a Hamlet value to an Inline.