-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Experimental markdown processor.
--   
--   This is an experimental Markdown processor in pure Haskell. It aims to
--   process Markdown efficiently and in the most forgiving possible way.
--   It is designed to deal with any input, including garbage, with linear
--   performance. Output is sanitized by default for protection against XSS
--   attacks.
--   
--   Several markdown extensions are implemented, including fenced code
--   blocks, significant list start numbers, and autolinked URLs. See
--   README.markdown for details.
@package cheapskate
@version 0.1.0.5

module Cheapskate.Types

-- | Structured representation of a document. The <a>Options</a> affect how
--   the document is rendered by <tt>toHtml</tt>.
data Doc
Doc :: Options -> Blocks -> Doc

-- | Block-level elements.
data Block
Para :: Inlines -> Block
Header :: Int -> Inlines -> Block
Blockquote :: Blocks -> Block
List :: Bool -> ListType -> [Blocks] -> Block
CodeBlock :: CodeAttr -> Text -> Block
HtmlBlock :: Text -> Block
HRule :: Block

-- | Attributes for fenced code blocks. <a>codeLang</a> is the first word
--   of the attribute line, <a>codeInfo</a> is the rest.
data CodeAttr
CodeAttr :: Text -> Text -> CodeAttr
[codeLang] :: CodeAttr -> Text
[codeInfo] :: CodeAttr -> Text
data ListType
Bullet :: Char -> ListType
Numbered :: NumWrapper -> Int -> ListType
data NumWrapper
PeriodFollowing :: NumWrapper
ParenFollowing :: NumWrapper

-- | Simple representation of HTML tag.
data HtmlTagType
Opening :: Text -> HtmlTagType
Closing :: Text -> HtmlTagType
SelfClosing :: Text -> HtmlTagType
type Blocks = Seq Block

-- | Inline elements.
data Inline
Str :: Text -> Inline
Space :: Inline
SoftBreak :: Inline
LineBreak :: Inline
Emph :: Inlines -> Inline
Strong :: Inlines -> Inline
Code :: Text -> Inline
Link :: Inlines -> Text -> Text -> Inline
Image :: Inlines -> Text -> Text -> Inline
Entity :: Text -> Inline
RawHtml :: Text -> Inline
type Inlines = Seq Inline
type ReferenceMap = Map Text (Text, Text)

-- | Rendering and parsing options.
data Options
Options :: Bool -> Bool -> Bool -> Bool -> Options

-- | Sanitize raw HTML, link/image attributes
[sanitize] :: Options -> Bool

-- | Allow raw HTML (if false it gets escaped)
[allowRawHtml] :: Options -> Bool

-- | Preserve hard line breaks in the source
[preserveHardBreaks] :: Options -> Bool

-- | Print container structure for debugging
[debug] :: Options -> Bool
instance Data.Data.Data Cheapskate.Types.Doc
instance GHC.Show.Show Cheapskate.Types.Doc
instance Data.Data.Data Cheapskate.Types.Options
instance GHC.Show.Show Cheapskate.Types.Options
instance Data.Data.Data Cheapskate.Types.Block
instance GHC.Show.Show Cheapskate.Types.Block
instance Data.Data.Data Cheapskate.Types.Inline
instance GHC.Show.Show Cheapskate.Types.Inline
instance Data.Data.Data Cheapskate.Types.HtmlTagType
instance GHC.Show.Show Cheapskate.Types.HtmlTagType
instance Data.Data.Data Cheapskate.Types.ListType
instance GHC.Show.Show Cheapskate.Types.ListType
instance GHC.Classes.Eq Cheapskate.Types.ListType
instance Data.Data.Data Cheapskate.Types.NumWrapper
instance GHC.Show.Show Cheapskate.Types.NumWrapper
instance GHC.Classes.Eq Cheapskate.Types.NumWrapper
instance Data.Data.Data Cheapskate.Types.CodeAttr
instance GHC.Show.Show Cheapskate.Types.CodeAttr
instance Data.Default.Class.Default Cheapskate.Types.Options

module Cheapskate.Html

-- | Render a markdown document as <a>Html</a>. (This can be turned into a
--   <a>Text</a> or <tt>ByteString</tt> using a renderer from the
--   <tt>blaze-html</tt> library.)
renderDoc :: Doc -> Html
renderBlocks :: Options -> Blocks -> Html
renderInlines :: Options -> Inlines -> Html

module Cheapskate.Parse

-- | Parses the input as a markdown document. Note that <a>Doc</a> is an
--   instance of <tt>ToMarkup</tt>, so the document can be converted to
--   <tt>Html</tt> using <tt>toHtml</tt>. A simple <a>Text</a> to
--   <tt>Html</tt> filter would be
--   
--   <pre>
--   markdownToHtml :: Text -&gt; Html
--   markdownToHtml = toHtml . markdown def
--   </pre>
markdown :: Options -> Text -> Doc
instance GHC.Show.Show Cheapskate.Parse.Elt
instance GHC.Show.Show Cheapskate.Parse.Leaf
instance GHC.Show.Show Cheapskate.Parse.ContainerType
instance GHC.Classes.Eq Cheapskate.Parse.ContainerType
instance GHC.Show.Show Cheapskate.Parse.Container

module Cheapskate

-- | Parses the input as a markdown document. Note that <a>Doc</a> is an
--   instance of <tt>ToMarkup</tt>, so the document can be converted to
--   <tt>Html</tt> using <tt>toHtml</tt>. A simple <a>Text</a> to
--   <tt>Html</tt> filter would be
--   
--   <pre>
--   markdownToHtml :: Text -&gt; Html
--   markdownToHtml = toHtml . markdown def
--   </pre>
markdown :: Options -> Text -> Doc

-- | The default value for this type.
def :: Default a => a

-- | Apply a transformation bottom-up to every node of a parsed document.
--   This can be used, for example, to transform specially marked code
--   blocks to highlighted code or images. Here is a simple example that
--   promotes the levels of headers:
--   
--   <pre>
--   promoteHeaders :: Doc -&gt; Doc
--   promoteHeaders = walk promoteHeader
--     where promoteHeader (Header n ils) = Header (n+1) ils
--           promoteHeader x              = x
--   </pre>
walk :: (Data a, Data b) => (a -> a) -> (b -> b)

-- | Monadic version of <a>walk</a>.
walkM :: (Data a, Data b, Monad m) => (a -> m a) -> (b -> m b)
instance Text.Blaze.ToMarkup Cheapskate.Types.Doc
