Safe Haskell | None |
---|---|
Language | Haskell2010 |
Commonmark.Blocks
Contents
Synopsis
- 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 :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => [BlockSpec m il bl]
- data BlockStartResult
- data BlockSpec (m :: Type -> Type) il bl = BlockSpec {
- blockType :: !Text
- blockStart :: BlockParser m il bl BlockStartResult
- blockCanContain :: BlockSpec m il bl -> Bool
- blockContainsLines :: !Bool
- blockParagraph :: !Bool
- blockContinue :: BlockNode m il bl -> BlockParser m il bl (SourcePos, BlockNode m il bl)
- blockConstructor :: BlockNode m il bl -> BlockParser m il bl bl
- blockFinalize :: BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl)
- data BlockData (m :: Type -> Type) il bl = BlockData {
- blockSpec :: BlockSpec m il bl
- blockLines :: [[Tok]]
- blockStartPos :: [SourcePos]
- blockData :: !Dynamic
- blockBlanks :: [Int]
- blockAttributes :: !Attributes
- defBlockData :: forall (m :: Type -> Type) il bl. BlockSpec m il bl -> BlockData m il bl
- type BlockNode (m :: Type -> Type) il bl = Tree (BlockData m il bl)
- data BPState (m :: Type -> Type) il bl = BPState {
- referenceMap :: !ReferenceMap
- inlineParser :: ReferenceMap -> [Tok] -> m (Either ParseError il)
- nodeStack :: [BlockNode m il bl]
- blockMatched :: !Bool
- maybeLazy :: !Bool
- maybeBlank :: !Bool
- counters :: Map Text Dynamic
- failurePositions :: Map Text SourcePos
- attributeParsers :: [ParsecT [Tok] (BPState m il bl) m Attributes]
- nextAttributes :: !Attributes
- type BlockParser (m :: Type -> Type) il bl = ParsecT [Tok] (BPState m il bl) m
- data LinkInfo = LinkInfo {
- linkDestination :: !Text
- linkTitle :: !Text
- linkAttributes :: !Attributes
- linkPos :: !(Maybe SourcePos)
- defaultFinalizer :: forall (m :: Type -> Type) il bl. Monad m => BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl)
- runInlineParser :: forall (m :: Type -> Type) il bl. Monad m => [Tok] -> BlockParser m il bl il
- addNodeToStack :: forall (m :: Type -> Type) bl il. Monad m => BlockNode m bl il -> BlockParser m bl il ()
- collapseNodeStack :: forall (m :: Type -> Type) il bl. [BlockNode m il bl] -> BlockParser m il bl (BlockNode m il bl)
- getBlockText :: forall (m :: Type -> Type) il bl. BlockNode m il bl -> [Tok]
- removeIndent :: [Tok] -> [Tok]
- bspec :: forall (m :: Type -> Type) il bl. BlockNode m il bl -> BlockSpec m il bl
- endOfBlock :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl ()
- interruptsParagraph :: forall (m :: Type -> Type) bl il. Monad m => BlockParser m bl il Bool
- linkReferenceDef :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Attributes -> ParsecT [Tok] s m ((SourceRange, Text), LinkInfo)
- renderChildren :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockNode m il bl -> BlockParser m il bl [bl]
- reverseSubforests :: Tree a -> Tree a
- getParentListType :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl (Maybe ListType)
- docSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl, Monoid bl) => BlockSpec m il bl
- indentedCodeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- fencedCodeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- blockQuoteSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- atxHeadingSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- setextHeadingSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- thematicBreakSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- listItemSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockParser m il bl ListType -> BlockSpec m il bl
- bulletListMarker :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl ListType
- orderedListMarker :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl ListType
- rawHtmlSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- attributeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- paraSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
- plainSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl
Documentation
Arguments
:: (Monad m, IsBlock il bl) | |
=> [BlockSpec m il bl] | Defines block syntax |
-> [BlockParser m il bl bl] | Parsers to run at end |
-> (ReferenceMap -> [Tok] -> m (Either ParseError il)) | Inline parser |
-> [BlockParser m il bl Attributes] | attribute parsers |
-> [Tok] | Tokenized commonmark input |
-> m (Either ParseError bl) | Result or error |
defaultBlockSpecs :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => [BlockSpec m il bl] Source #
data BlockStartResult Source #
Constructors
BlockStartMatch | |
BlockStartNoMatchBefore !SourcePos |
Instances
Show BlockStartResult Source # | |
Defined in Commonmark.Blocks Methods showsPrec :: Int -> BlockStartResult -> ShowS show :: BlockStartResult -> String showList :: [BlockStartResult] -> ShowS | |
Eq BlockStartResult Source # | |
Defined in Commonmark.Blocks Methods (==) :: BlockStartResult -> BlockStartResult -> Bool (/=) :: BlockStartResult -> BlockStartResult -> Bool |
data BlockSpec (m :: Type -> Type) il bl Source #
Defines a block-level element type.
Constructors
BlockSpec | |
Fields
|
data BlockData (m :: Type -> Type) il bl Source #
Constructors
BlockData | |
Fields
|
defBlockData :: forall (m :: Type -> Type) il bl. BlockSpec m il bl -> BlockData m il bl Source #
data BPState (m :: Type -> Type) il bl Source #
Constructors
BPState | |
Fields
|
type BlockParser (m :: Type -> Type) il bl = ParsecT [Tok] (BPState m il bl) m Source #
Constructors
LinkInfo | |
Fields
|
defaultFinalizer :: forall (m :: Type -> Type) il bl. Monad m => BlockNode m il bl -> BlockNode m il bl -> BlockParser m il bl (BlockNode m il bl) Source #
runInlineParser :: forall (m :: Type -> Type) il bl. Monad m => [Tok] -> BlockParser m il bl il Source #
addNodeToStack :: forall (m :: Type -> Type) bl il. Monad m => BlockNode m bl il -> BlockParser m bl il () Source #
collapseNodeStack :: forall (m :: Type -> Type) il bl. [BlockNode m il bl] -> BlockParser m il bl (BlockNode m il bl) Source #
getBlockText :: forall (m :: Type -> Type) il bl. BlockNode m il bl -> [Tok] Source #
removeIndent :: [Tok] -> [Tok] Source #
endOfBlock :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl () Source #
interruptsParagraph :: forall (m :: Type -> Type) bl il. Monad m => BlockParser m bl il Bool Source #
linkReferenceDef :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Attributes -> ParsecT [Tok] s m ((SourceRange, Text), LinkInfo) Source #
renderChildren :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockNode m il bl -> BlockParser m il bl [bl] Source #
reverseSubforests :: Tree a -> Tree a Source #
getParentListType :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl (Maybe ListType) Source #
Get type of the enclosing List block. If the parent isn't a List block, return Nothing.
BlockSpecs
docSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl, Monoid bl) => BlockSpec m il bl Source #
indentedCodeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
fencedCodeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
blockQuoteSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
atxHeadingSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
setextHeadingSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
thematicBreakSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
listItemSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockParser m il bl ListType -> BlockSpec m il bl Source #
bulletListMarker :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl ListType Source #
orderedListMarker :: forall (m :: Type -> Type) il bl. Monad m => BlockParser m il bl ListType Source #
rawHtmlSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #
attributeSpec :: forall (m :: Type -> Type) il bl. (Monad m, IsBlock il bl) => BlockSpec m il bl Source #