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

-- | Pure Haskell commonmark parser.
--   
--   This library provides the core data types and functions for parsing
--   commonmark (https://spec.commonmark.org). The parser is fully
--   commonmark-compliant and passes the test suite. It is designed to be
--   customizable and easily extensible. To customize the output, create an
--   AST, or support a new output format, one need only define some new
--   typeclass instances. It is also easy to add new syntax elements or
--   modify existing ones.
--   
--   Accurate information about source positions is available for all block
--   and inline elements. Thus the library can be used to create an
--   accurate syntax highlighter or an editor with live preview.
--   
--   The parser has been designed for robust performance even in
--   pathological cases that tend to cause stack overflows or exponential
--   slowdowns in other parsers, with parsing speed that varies linearly
--   with input length.
--   
--   Related packages:
--   
--   
--   
- commonmark-extensions (which defines a number of syntax
--   extensions)
--   
- commonmark-pandoc (which allows using this parser to create a
--   Pandoc structure)
--   
- commonmark-cli (a command-line tool for converting and
--   syntax-highlighting commonmark documents)
--   
@package commonmark
@version 0.2.6.1

module Commonmark.Tokens
data Tok
Tok :: !TokType -> !SourcePos -> {-# UNPACK #-} !Text -> Tok
[tokType] :: Tok -> !TokType
[tokPos] :: Tok -> !SourcePos
[tokContents] :: Tok -> {-# UNPACK #-} !Text
data TokType
Spaces :: TokType
UnicodeSpace :: TokType
LineEnd :: TokType
WordChars :: TokType
Symbol :: {-# UNPACK #-} !Char -> TokType

-- | The abstract data type SourcePos represents source positions.
--   It contains the name of the source (i.e. file name), a line number and
--   a column number. SourcePos is an instance of the Show,
--   Eq and Ord class.
data () => SourcePos

-- | Convert a Text into a list of Tok. The first parameter
--   species the source name.
tokenize :: String -> Text -> [Tok]

-- | Reverses tokenize. untokenize . tokenize should be the
--   identity.
untokenize :: [Tok] -> Text
instance Data.Data.Data Commonmark.Tokens.TokType
instance GHC.Classes.Ord Commonmark.Tokens.TokType
instance GHC.Classes.Eq Commonmark.Tokens.TokType
instance GHC.Show.Show Commonmark.Tokens.TokType
instance Data.Data.Data Commonmark.Tokens.Tok
instance GHC.Classes.Eq Commonmark.Tokens.Tok
instance GHC.Show.Show Commonmark.Tokens.Tok

module Commonmark.TokParsers

-- | Parses a single Tok satisfying a predicate.
satisfyTok :: Monad m => (Tok -> Bool) -> ParsecT [Tok] s m Tok

-- | Parses a WordChars token matching a predicate.
satisfyWord :: Monad m => (Text -> Bool) -> ParsecT [Tok] s m Tok

-- | Parses any Tok.
anyTok :: Monad m => ParsecT [Tok] s m Tok

-- | Parses any Symbol Tok.
anySymbol :: Monad m => ParsecT [Tok] s m Tok

-- | Parses a Symbol with character c.
symbol :: Monad m => Char -> ParsecT [Tok] s m Tok

-- | Parses one or more whitespace Toks.
whitespace :: Monad m => ParsecT [Tok] s m [Tok]

-- | Parses a LineEnd token.
lineEnd :: Monad m => ParsecT [Tok] s m Tok

-- | Parses a Spaces token.
spaceTok :: Monad m => ParsecT [Tok] s m Tok

-- | Parses a Tok with one of the listed types.
oneOfToks :: Monad m => [TokType] -> ParsecT [Tok] s m Tok

-- | Parses a Tok with none of the listed types.
noneOfToks :: Monad m => [TokType] -> ParsecT [Tok] s m Tok

-- | Parses exactly n spaces. If tabs are encountered, they are
--   split into spaces before being consumed; so a tab may be partially
--   consumed by this parser.
gobbleSpaces :: Monad m => Int -> ParsecT [Tok] u m Int

-- | Parses up to n spaces.
gobbleUpToSpaces :: Monad m => Int -> ParsecT [Tok] u m Int

-- | Applies a parser and returns its value (if successful) plus a list of
--   the raw tokens parsed.
withRaw :: Monad m => ParsecT [Tok] s m a -> ParsecT [Tok] s m (a, [Tok])

-- | Filters tokens of a certain type.
hasType :: TokType -> Tok -> Bool

-- | Filters tokens with certain contents.
textIs :: (Text -> Bool) -> Tok -> Bool

-- | Parse optional spaces and an endline.
blankLine :: Monad m => ParsecT [Tok] s m ()

-- | Efficiently parse the remaining tokens on a line, including the
--   LineEnd (if any).
restOfLine :: Monad m => ParsecT [Tok] s m [Tok]

-- | Case-insensitive membership in a list of Texts.
isOneOfCI :: [Text] -> Text -> Bool

-- | Gobble up to 3 spaces (may be part of a tab).
nonindentSpaces :: Monad m => ParsecT [Tok] u m ()

-- | Apply p many times until stop succeeds, discarding
--   results.
skipManyTill :: ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m ()

-- | Efficiently skip Toks satisfying a certain condition.
skipWhile :: Monad m => (Tok -> Bool) -> ParsecT [Tok] u m ()

module Commonmark.Tag
htmlTag :: Monad m => ParsecT [Tok] s (StateT Enders m) [Tok]

-- | An open tag consists of a < character, a tag name, zero or
--   more attributes, optional whitespace, an optional /
--   character, and a > character. This parses assumes that the
--   opening < has already been parsed.
htmlOpenTag :: Monad m => ParsecT [Tok] s m [Tok]

-- | A closing tag consists of the string </, a tag name,
--   optional whitespace, and the character >. This parser
--   assumes that the opening < has already been parsed.
htmlClosingTag :: Monad m => ParsecT [Tok] s m [Tok]
htmlAttributeName :: Monad m => ParsecT [Tok] s m [Tok]
htmlAttributeValue :: Monad m => ParsecT [Tok] s m [Tok]
htmlDoubleQuotedAttributeValue :: Monad m => ParsecT [Tok] s m [Tok]
data Enders
defaultEnders :: Enders
instance GHC.Show.Show Commonmark.Tag.Enders

module Commonmark.Entity

-- | Lookup an entity, using lookupNumericEntity if it starts with
--   # and lookupNamedEntity otherwise
lookupEntity :: Text -> Maybe Text
charEntity :: Monad m => ParsecT [Tok] s m [Tok]
numEntity :: Monad m => ParsecT [Tok] s m [Tok]
pEntity :: Monad m => ParsecT [Tok] s m Tok
unEntity :: [Tok] -> Text

module Commonmark.Types
newtype Format
Format :: Text -> Format
data ListSpacing
TightList :: ListSpacing
LooseList :: ListSpacing
data ListType
BulletList :: !Char -> ListType
OrderedList :: !Int -> !EnumeratorType -> !DelimiterType -> ListType
data DelimiterType
Period :: DelimiterType
OneParen :: DelimiterType
TwoParens :: DelimiterType
data EnumeratorType
Decimal :: EnumeratorType
UpperAlpha :: EnumeratorType
LowerAlpha :: EnumeratorType
UpperRoman :: EnumeratorType
LowerRoman :: EnumeratorType
class (Monoid a, Show a, Rangeable a, HasAttributes a) => IsInline a
lineBreak :: IsInline a => a
softBreak :: IsInline a => a
str :: IsInline a => Text -> a
entity :: IsInline a => Text -> a
escapedChar :: IsInline a => Char -> a
emph :: IsInline a => a -> a
strong :: IsInline a => a -> a
link :: IsInline a => Text -> Text -> a -> a
image :: IsInline a => Text -> Text -> a -> a
code :: IsInline a => Text -> a
rawInline :: IsInline a => Format -> Text -> a
class (Monoid b, Show b, Rangeable b, IsInline il, HasAttributes b) => IsBlock il b | b -> il
paragraph :: IsBlock il b => il -> b
plain :: IsBlock il b => il -> b
thematicBreak :: IsBlock il b => b
blockQuote :: IsBlock il b => b -> b
codeBlock :: IsBlock il b => Text -> Text -> b
heading :: IsBlock il b => Int -> il -> b
rawBlock :: IsBlock il b => Format -> Text -> b
referenceLinkDefinition :: IsBlock il b => Text -> (Text, Text) -> b
list :: IsBlock il b => ListType -> ListSpacing -> [b] -> b
newtype SourceRange
SourceRange :: [(SourcePos, SourcePos)] -> SourceRange
[unSourceRange] :: SourceRange -> [(SourcePos, SourcePos)]
class Rangeable a
ranged :: Rangeable a => SourceRange -> a -> a
type Attribute = (Text, Text)
type Attributes = [Attribute]
class HasAttributes a
addAttributes :: HasAttributes a => Attributes -> a -> a
class ToPlainText a
toPlainText :: ToPlainText a => a -> Text

-- | The abstract data type SourcePos represents source positions.
--   It contains the name of the source (i.e. file name), a line number and
--   a column number. SourcePos is an instance of the Show,
--   Eq and Ord class.
data () => SourcePos

-- | Extracts the line number from a source position.
sourceLine :: SourcePos -> Line

-- | Extracts the column number from a source position.
sourceColumn :: SourcePos -> Column

-- | Extracts the name of the source from a source position.
sourceName :: SourcePos -> SourceName
instance Data.Data.Data Commonmark.Types.Format
instance GHC.Show.Show Commonmark.Types.Format
instance Data.Data.Data Commonmark.Types.ListSpacing
instance GHC.Classes.Eq Commonmark.Types.ListSpacing
instance GHC.Classes.Ord Commonmark.Types.ListSpacing
instance GHC.Show.Show Commonmark.Types.ListSpacing
instance Data.Data.Data Commonmark.Types.EnumeratorType
instance GHC.Classes.Eq Commonmark.Types.EnumeratorType
instance GHC.Classes.Ord Commonmark.Types.EnumeratorType
instance GHC.Show.Show Commonmark.Types.EnumeratorType
instance Data.Data.Data Commonmark.Types.DelimiterType
instance GHC.Classes.Eq Commonmark.Types.DelimiterType
instance GHC.Classes.Ord Commonmark.Types.DelimiterType
instance GHC.Show.Show Commonmark.Types.DelimiterType
instance Data.Data.Data Commonmark.Types.ListType
instance GHC.Classes.Eq Commonmark.Types.ListType
instance GHC.Classes.Ord Commonmark.Types.ListType
instance GHC.Show.Show Commonmark.Types.ListType
instance Data.Data.Data Commonmark.Types.SourceRange
instance GHC.Classes.Ord Commonmark.Types.SourceRange
instance GHC.Classes.Eq Commonmark.Types.SourceRange
instance GHC.Base.Semigroup Commonmark.Types.SourceRange
instance GHC.Base.Monoid Commonmark.Types.SourceRange
instance GHC.Show.Show Commonmark.Types.SourceRange
instance GHC.Classes.Eq Commonmark.Types.Format

module Commonmark.SourceMap

-- | A map from source positions to a pair of sequences: first, elements
--   that start at that position; then, elements that end at that position.
newtype SourceMap
SourceMap :: Map SourcePos (Seq Text, Seq Text) -> SourceMap
[unSourceMap] :: SourceMap -> Map SourcePos (Seq Text, Seq Text)

-- | Use this when you want to extract a source map as well as the parsed
--   content.
newtype WithSourceMap a
WithSourceMap :: State (Maybe Text, SourceMap) a -> WithSourceMap a
[unWithSourceMap] :: WithSourceMap a -> State (Maybe Text, SourceMap) a

-- | Extract a parsed value and a source map from a WithSourceMap.
runWithSourceMap :: (Show a, Monoid a) => WithSourceMap a -> (a, SourceMap)
addName :: Text -> WithSourceMap ()
instance GHC.Show.Show Commonmark.SourceMap.SourceMap
instance GHC.Base.Monad Commonmark.SourceMap.WithSourceMap
instance GHC.Base.Applicative Commonmark.SourceMap.WithSourceMap
instance GHC.Base.Functor Commonmark.SourceMap.WithSourceMap
instance Commonmark.Types.HasAttributes (Commonmark.SourceMap.WithSourceMap a)
instance (GHC.Show.Show a, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Commonmark.SourceMap.WithSourceMap a)
instance (GHC.Show.Show a, GHC.Base.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (Commonmark.SourceMap.WithSourceMap a)
instance (GHC.Show.Show a, GHC.Base.Monoid a) => GHC.Show.Show (Commonmark.SourceMap.WithSourceMap a)
instance (Commonmark.Types.IsInline a, GHC.Base.Semigroup a) => Commonmark.Types.IsInline (Commonmark.SourceMap.WithSourceMap a)
instance (Commonmark.Types.IsBlock b a, Commonmark.Types.IsInline b, Commonmark.Types.IsInline (Commonmark.SourceMap.WithSourceMap b), GHC.Base.Semigroup a) => Commonmark.Types.IsBlock (Commonmark.SourceMap.WithSourceMap b) (Commonmark.SourceMap.WithSourceMap a)
instance (Commonmark.Types.Rangeable a, GHC.Base.Monoid a, GHC.Show.Show a) => Commonmark.Types.Rangeable (Commonmark.SourceMap.WithSourceMap a)
instance Commonmark.Types.ToPlainText a => Commonmark.Types.ToPlainText (Commonmark.SourceMap.WithSourceMap a)
instance GHC.Base.Semigroup Commonmark.SourceMap.SourceMap
instance GHC.Base.Monoid Commonmark.SourceMap.SourceMap

module Commonmark.ReferenceMap

-- | Lookup table for link references.
newtype ReferenceMap
ReferenceMap :: Map Text [Dynamic] -> ReferenceMap
[unReferenceMap] :: ReferenceMap -> Map Text [Dynamic]
data LinkInfo
LinkInfo :: !Text -> !Text -> !Attributes -> !Maybe SourcePos -> LinkInfo
[linkDestination] :: LinkInfo -> !Text
[linkTitle] :: LinkInfo -> !Text
[linkAttributes] :: LinkInfo -> !Attributes

-- | Position of the reference link definition for references links.
[linkPos] :: LinkInfo -> !Maybe SourcePos
emptyReferenceMap :: ReferenceMap

-- | Insert a link reference into a reference map.
insertReference :: Typeable a => Text -> a -> ReferenceMap -> ReferenceMap

-- | Lookup a reference in a reference map. If there are several values at
--   this key, we return the first one in the list that can be converted to
--   an a.
lookupReference :: Typeable a => Text -> ReferenceMap -> Maybe a
instance GHC.Show.Show Commonmark.ReferenceMap.ReferenceMap
instance GHC.Show.Show Commonmark.ReferenceMap.LinkInfo

module Commonmark.Inlines
mkInlineParser :: (Monad m, IsInline a) => [BracketedSpec a] -> [FormattingSpec a] -> [InlineParser m a] -> [InlineParser m Attributes] -> ReferenceMap -> [Tok] -> m (Either ParseError a)
defaultInlineParser :: (Monad m, IsInline a) => InlineParser m a
data IPState m

-- | Specifies delimiters for formatting, e.g. strong emphasis.
type InlineParser m = ParsecT [Tok] (IPState m) (StateT Enders m)
getReferenceMap :: Monad m => InlineParser m ReferenceMap
data FormattingSpec il
FormattingSpec :: !Char -> !Bool -> !Bool -> Maybe (il -> il) -> Maybe (il -> il) -> !Char -> FormattingSpec il

-- | Character that triggers formatting
[formattingDelimChar] :: FormattingSpec il -> !Char

-- | True if formatting can start/end in a word
[formattingIntraWord] :: FormattingSpec il -> !Bool

-- | Treat punctuation like letters for purposes of computing can open/can
--   close
[formattingIgnorePunctuation] :: FormattingSpec il -> !Bool

-- | Constructor to use for text between single delimiters.
[formattingSingleMatch] :: FormattingSpec il -> Maybe (il -> il)

-- | Constructor to use for text between double delimiters.
[formattingDoubleMatch] :: FormattingSpec il -> Maybe (il -> il)

-- | Fallback when not matched.
[formattingWhenUnmatched] :: FormattingSpec il -> !Char
defaultFormattingSpecs :: IsInline il => [FormattingSpec il]
data BracketedSpec il
BracketedSpec :: !Text -> !Bool -> Maybe Char -> Maybe Char -> (ReferenceMap -> Text -> Parsec [Tok] () (il -> il)) -> BracketedSpec il

-- | Name of bracketed text type.
[bracketedName] :: BracketedSpec il -> !Text

-- | True if this can be nested.
[bracketedNests] :: BracketedSpec il -> !Bool

-- | Prefix character.
[bracketedPrefix] :: BracketedSpec il -> Maybe Char

-- | Suffix character.
[bracketedSuffixEnd] :: BracketedSpec il -> Maybe Char

-- | Parser for suffix after brackets. Returns a constructor. Second
--   parameter is the raw key.
[bracketedSuffix] :: BracketedSpec il -> ReferenceMap -> Text -> Parsec [Tok] () (il -> il)
defaultBracketedSpecs :: IsInline il => [BracketedSpec il]
data LinkInfo
LinkInfo :: !Text -> !Text -> !Attributes -> !Maybe SourcePos -> LinkInfo
[linkDestination] :: LinkInfo -> !Text
[linkTitle] :: LinkInfo -> !Text
[linkAttributes] :: LinkInfo -> !Attributes

-- | Position of the reference link definition for references links.
[linkPos] :: LinkInfo -> !Maybe SourcePos
imageSpec :: IsInline il => BracketedSpec il
linkSpec :: IsInline il => BracketedSpec il
pLink :: ReferenceMap -> Text -> Parsec [Tok] s LinkInfo
pLinkLabel :: Monad m => ParsecT [Tok] s m Text
pLinkDestination :: Monad m => ParsecT [Tok] s m [Tok]
pLinkTitle :: Monad m => ParsecT [Tok] s m [Tok]
pEscaped :: Monad m => ParsecT [Tok] s m Tok
pEscapedSymbol :: Monad m => ParsecT [Tok] s m Tok
processEmphasis :: IsInline a => [Chunk a] -> [Chunk a]

-- | Process square brackets: links, images, and the span extension.
--   
--   DState tracks the current position and backtracking limits.
--   
--   If this function succeeds, returning Right, it will return a
--   list of chunks, now annotated with bracket information.
--   
--   If this function fails, it will return `Left DState`. This can happen
--   if a chunk straddles a link destination, like this
--   
--   link text looks like code` ^-----------------^
--   
--   To recover, the caller must re-Chunk everything after the end paren.
--   The bottoms parameter, in particular, is DState's
--   stackBottoms, and is used to prevent things before the paren
--   from being re-parsed.
processBrackets :: IsInline a => [BracketedSpec a] -> ReferenceMap -> [Chunk a] -> Map Text SourcePos -> Either (DState a) [Chunk a]
pBacktickSpan :: Monad m => Tok -> InlineParser m (Either [Tok] [Tok])
normalizeCodeSpan :: Text -> Text
withAttributes :: (IsInline a, Monad m) => InlineParser m a -> InlineParser m a
instance GHC.Show.Show a => GHC.Show.Show (Commonmark.Inlines.ChunkType a)
instance GHC.Show.Show a => GHC.Show.Show (Commonmark.Inlines.Chunk a)
instance GHC.Show.Show a => GHC.Show.Show (Commonmark.Inlines.Cursor a)
instance GHC.Show.Show (Commonmark.Inlines.BracketedSpec il)
instance GHC.Show.Show (Commonmark.Inlines.FormattingSpec il)

module Commonmark.Html
data Html a
htmlInline :: Text -> Maybe (Html a) -> Html a
htmlBlock :: Text -> Maybe (Html a) -> Html a
htmlText :: Text -> Html a
htmlRaw :: Text -> Html a
addAttribute :: Attribute -> Html a -> Html a
renderHtml :: Html a -> Text
escapeURI :: Text -> Text
escapeHtml :: Text -> Builder
instance GHC.Show.Show (Commonmark.Html.Html a)
instance GHC.Base.Semigroup (Commonmark.Html.Html a)
instance GHC.Base.Monoid (Commonmark.Html.Html a)
instance Commonmark.Types.HasAttributes (Commonmark.Html.Html a)
instance Commonmark.Types.ToPlainText (Commonmark.Html.Html a)
instance Commonmark.Types.Rangeable (Commonmark.Html.Html a) => Commonmark.Types.IsInline (Commonmark.Html.Html a)
instance Commonmark.Types.IsInline (Commonmark.Html.Html a) => Commonmark.Types.IsBlock (Commonmark.Html.Html a) (Commonmark.Html.Html a)
instance Commonmark.Types.Rangeable (Commonmark.Html.Html ())
instance Commonmark.Types.Rangeable (Commonmark.Html.Html Commonmark.Types.SourceRange)

module Commonmark.Blocks
mkBlockParser :: (Monad m, IsBlock il bl) => [BlockSpec m il bl] -> [BlockParser m il bl bl] -> (ReferenceMap -> [Tok] -> m (Either ParseError il)) -> [BlockParser m il bl Attributes] -> [Tok] -> m (Either ParseError bl)
defaultBlockSpecs :: (Monad m, IsBlock il bl) => [BlockSpec m il bl]
data BlockStartResult
BlockStartMatch :: BlockStartResult
BlockStartNoMatchBefore :: !SourcePos -> BlockStartResult

-- | Defines a block-level element type.
data BlockSpec m il bl
BlockSpec :: !Text -> BlockParser m il bl BlockStartResult -> (BlockSpec m il bl -> Bool) -> !Bool -> !Bool -> (BlockNode m il bl -> BlockParser m il bl (SourcePos, BlockNode m il bl)) -> (BlockNode m il bl -> BlockParser m il bl bl) -> (BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl)) -> BlockSpec m il bl

-- | Descriptive name of block type
[blockType] :: BlockSpec m il bl -> !Text

-- | Parses beginning of block. The parser should verify any preconditions,
--   parse the opening of the block, and add the new block to the block
--   stack using addNodeToStack, returning BlockStartMatch on
--   success. If the match fails, the parser can either fail or return
--   BlockStartNoMatchBefore and a SourcePos before which the
--   parser is known not to succeed (this will be stored in
--   failurePositions for the line, to ensure that future matches
--   won't be attempted until after that position).
[blockStart] :: BlockSpec m il bl -> BlockParser m il bl BlockStartResult

-- | Returns True if this kind of block can contain the specified block
--   type.
[blockCanContain] :: BlockSpec m il bl -> BlockSpec m il bl -> Bool

-- | True if this kind of block can contain text lines.
[blockContainsLines] :: BlockSpec m il bl -> !Bool

-- | True if this kind of block is paragraph.
[blockParagraph] :: BlockSpec m il bl -> !Bool

-- | Parser that checks to see if the current block (the BlockNode)
--   can be kept open. If it fails, the block will be closed, unless we
--   have a lazy paragraph continuation within the block.
[blockContinue] :: BlockSpec m il bl -> BlockNode m il bl -> BlockParser m il bl (SourcePos, BlockNode m il bl)

-- | Renders the node into its target format, possibly after rendering
--   inline content.
[blockConstructor] :: BlockSpec m il bl -> BlockNode m il bl -> BlockParser m il bl bl

-- | Runs when the block is closed, but prior to rendering. The first
--   parameter is the child, the second the parent.
[blockFinalize] :: BlockSpec m il bl -> BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl)
data BlockData m il bl
BlockData :: BlockSpec m il bl -> [[Tok]] -> [SourcePos] -> !Dynamic -> [Int] -> !Attributes -> BlockData m il bl
[blockSpec] :: BlockData m il bl -> BlockSpec m il bl
[blockLines] :: BlockData m il bl -> [[Tok]]
[blockStartPos] :: BlockData m il bl -> [SourcePos]
[blockData] :: BlockData m il bl -> !Dynamic
[blockBlanks] :: BlockData m il bl -> [Int]
[blockAttributes] :: BlockData m il bl -> !Attributes
defBlockData :: BlockSpec m il bl -> BlockData m il bl
type BlockNode m il bl = Tree (BlockData m il bl)
data BPState m il bl
BPState :: !ReferenceMap -> (ReferenceMap -> [Tok] -> m (Either ParseError il)) -> [BlockNode m il bl] -> !Bool -> !Bool -> !Bool -> Map Text Dynamic -> Map Text SourcePos -> [ParsecT [Tok] (BPState m il bl) m Attributes] -> !Attributes -> BPState m il bl
[referenceMap] :: BPState m il bl -> !ReferenceMap
[inlineParser] :: BPState m il bl -> ReferenceMap -> [Tok] -> m (Either ParseError il)
[nodeStack] :: BPState m il bl -> [BlockNode m il bl]
[blockMatched] :: BPState m il bl -> !Bool
[maybeLazy] :: BPState m il bl -> !Bool
[maybeBlank] :: BPState m il bl -> !Bool
[counters] :: BPState m il bl -> Map Text Dynamic
[failurePositions] :: BPState m il bl -> Map Text SourcePos
[attributeParsers] :: BPState m il bl -> [ParsecT [Tok] (BPState m il bl) m Attributes]
[nextAttributes] :: BPState m il bl -> !Attributes
type BlockParser m il bl = ParsecT [Tok] (BPState m il bl) m
data LinkInfo
LinkInfo :: !Text -> !Text -> !Attributes -> !Maybe SourcePos -> LinkInfo
[linkDestination] :: LinkInfo -> !Text
[linkTitle] :: LinkInfo -> !Text
[linkAttributes] :: LinkInfo -> !Attributes

-- | Position of the reference link definition for references links.
[linkPos] :: LinkInfo -> !Maybe SourcePos
defaultFinalizer :: Monad m => BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl)
runInlineParser :: Monad m => [Tok] -> BlockParser m il bl il
addNodeToStack :: Monad m => BlockNode m bl il -> BlockParser m bl il ()
collapseNodeStack :: [BlockNode m il bl] -> BlockParser m il bl (BlockNode m il bl)
getBlockText :: BlockNode m il bl -> [Tok]
removeIndent :: [Tok] -> [Tok]
bspec :: BlockNode m il bl -> BlockSpec m il bl
endOfBlock :: Monad m => BlockParser m il bl ()
interruptsParagraph :: Monad m => BlockParser m bl il Bool
linkReferenceDef :: Monad m => ParsecT [Tok] s m Attributes -> ParsecT [Tok] s m ((SourceRange, Text), LinkInfo)
renderChildren :: (Monad m, IsBlock il bl) => BlockNode m il bl -> BlockParser m il bl [bl]
reverseSubforests :: Tree a -> Tree a

-- | Get type of the enclosing List block. If the parent isn't a List
--   block, return Nothing.
getParentListType :: Monad m => BlockParser m il bl (Maybe ListType)
docSpec :: (Monad m, IsBlock il bl, Monoid bl) => BlockSpec m il bl
indentedCodeSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
fencedCodeSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
blockQuoteSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
atxHeadingSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
setextHeadingSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
thematicBreakSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
listItemSpec :: (Monad m, IsBlock il bl) => BlockParser m il bl ListType -> BlockSpec m il bl
bulletListMarker :: Monad m => BlockParser m il bl ListType
orderedListMarker :: Monad m => BlockParser m il bl ListType
rawHtmlSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
attributeSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
paraSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
plainSpec :: (Monad m, IsBlock il bl) => BlockSpec m il bl
instance GHC.Classes.Eq Commonmark.Blocks.BlockStartResult
instance GHC.Show.Show Commonmark.Blocks.BlockStartResult
instance GHC.Show.Show (Commonmark.Blocks.BlockData m il bl)
instance GHC.Classes.Eq Commonmark.Blocks.ListData
instance GHC.Show.Show Commonmark.Blocks.ListData
instance GHC.Classes.Eq Commonmark.Blocks.ListItemData
instance GHC.Show.Show Commonmark.Blocks.ListItemData
instance GHC.Show.Show (Commonmark.Blocks.BlockSpec m il bl)

module Commonmark.Syntax

-- | A SyntaxSpec defines a basic collection of syntax elements or
--   an extension. SyntaxSpecs can be composed using monoidal
--   mappend.
data SyntaxSpec m il bl
SyntaxSpec :: [BlockSpec m il bl] -> [BracketedSpec il] -> [FormattingSpec il] -> [InlineParser m il] -> [BlockParser m il bl bl] -> (forall u m1. Monad m1 => [ParsecT [Tok] u m1 Attributes]) -> SyntaxSpec m il bl

-- | Defines block structure
[syntaxBlockSpecs] :: SyntaxSpec m il bl -> [BlockSpec m il bl]

-- | Defines bracketed inline containers (inli, image)
[syntaxBracketedSpecs] :: SyntaxSpec m il bl -> [BracketedSpec il]

-- | Defines formatted inline containers (strong, emph)
[syntaxFormattingSpecs] :: SyntaxSpec m il bl -> [FormattingSpec il]

-- | Defines inline elements that don't contain inlines
[syntaxInlineParsers] :: SyntaxSpec m il bl -> [InlineParser m il]

-- | Run at the end of document, e.g. to collect footnotes
[syntaxFinalParsers] :: SyntaxSpec m il bl -> [BlockParser m il bl bl]

-- | Parse attributes
[syntaxAttributeParsers] :: SyntaxSpec m il bl -> forall u m1. Monad m1 => [ParsecT [Tok] u m1 Attributes]

-- | Standard commonmark syntax.
defaultSyntaxSpec :: (Monad m, IsBlock il bl, IsInline il) => SyntaxSpec m il bl
instance GHC.Base.Semigroup (Commonmark.Syntax.SyntaxSpec m il bl)
instance GHC.Base.Monoid (Commonmark.Syntax.SyntaxSpec m il bl)

module Commonmark.Parser

-- | Parse a commonmark document using the core syntax elements. To produce
--   HTML, instantiate bl with Html () (see
--   Html. If you want to add syntax extensions or run the parser in
--   a monadic context, use commonmarkWith. If you want to operate
--   on tokenized input, use parseCommonmarkWith.
commonmark :: IsBlock il bl => String -> Text -> Either ParseError bl

-- | Like commonmark, but allows specifying a custom syntax and a
--   monadic context (since some syntax extensions may only be defined in
--   certain monads, e.g. an extension for include files may require IO).
commonmarkWith :: (Monad m, IsBlock il bl, IsInline il) => SyntaxSpec m il bl -> String -> Text -> m (Either ParseError bl)

-- | Parse a tokenized commonmark document using specified syntax elements.
--   Use tokenize to convert Text into [Tok].
parseCommonmarkWith :: (Monad m, IsBlock il bl, IsInline il) => SyntaxSpec m il bl -> [Tok] -> m (Either ParseError bl)

-- | The abstract data type ParseError represents parse errors. It
--   provides the source position (SourcePos) of the error and a
--   list of error messages (Message). A ParseError can be
--   returned by the function parse. ParseError is an
--   instance of the Show and Eq classes.
data () => ParseError

-- | The basic task of this library is to parse text as commonmark. Usage
--   example:
--   
--   
--   {-# LANGUAGE ScopedTypeVariables #-}
--   import Commonmark
--   import Data.Text.IO as TIO
--   import Data.Text.Lazy.IO as TLIO
--   
--   main = do
--     res <- commonmark "stdin" <$> TIO.getContents
--     case res of
--       Left e                  -> error (show e)
--       Right (html :: Html ()) -> TLIO.putStr $ renderHtml html
--   
--   
--   The parser is highly polymorphic: in this example, we use the type
--   annotation Html () to indicate that we want it to
--   produce basic HTML without source location attributes. And we return a
--   value in the IO monad. But we could have used a different output
--   format (e.g. Html SourceRange for HTML with
--   source location attributes). And we could have used the Identity monad
--   to get a pure value. (The default parsers work the same way in any
--   monad, but it is possible to define extensions that constrain the
--   monad. For example, an extension for include files might only work in
--   IO, or might have different behavior in IO and Identity.)
--   
--   Extensibility is emphasized throughout. To change the output for a
--   given format, or support an alternate output format, one has only to
--   define instances of IsBlock and IsInline for a new type.
--   (For an example of this kind of extension, see the
--   commonmark-pandoc package, which defines these instances for
--   pandoc's native types.)
--   
--   Supporting a new syntactic element generally requires (a) adding a
--   SyntaxSpec for it and (b) defining new type classes. See the
--   examples in the commonmark-extensions package. Note that
--   SyntaxSpec is a Monoid, so one can extend
--   defaultSyntaxSpec by specifying myNewSyntaxSpec <>
--   defaultSyntaxSpec.
module Commonmark
