commonmark-0.2.3: Pure Haskell commonmark parser.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Commonmark.Inlines

Synopsis

- 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
- type InlineParser m = ParsecT [Tok] (IPState m) (StateT Enders m)
- getReferenceMap :: Monad m => InlineParser m ReferenceMap
- data FormattingSpec il = FormattingSpec {
  - formattingDelimChar :: !Char
  - formattingIntraWord :: !Bool
  - formattingIgnorePunctuation :: !Bool
  - formattingSingleMatch :: Maybe (il -> il)
  - formattingDoubleMatch :: Maybe (il -> il)
  - formattingWhenUnmatched :: !Char
  }
- defaultFormattingSpecs :: IsInline il => [FormattingSpec il]
- data BracketedSpec il = BracketedSpec {
  - bracketedName :: !Text
  - bracketedNests :: !Bool
  - bracketedPrefix :: Maybe Char
  - bracketedSuffixEnd :: Maybe Char
  - bracketedSuffix :: ReferenceMap -> Text -> Parsec [Tok] () (il -> il)
  }
- defaultBracketedSpecs :: IsInline il => [BracketedSpec il]
- data LinkInfo = LinkInfo {
  - linkDestination :: !Text
  - linkTitle :: !Text
  - linkAttributes :: !Attributes
  - linkPos :: !(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
- processEmphasis :: IsInline a => [Chunk a] -> [Chunk a]
- processBrackets :: IsInline a => [BracketedSpec a] -> ReferenceMap -> [Chunk 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

# Documentation

mkInlineParser :: (Monad m, IsInline a) => [BracketedSpec a] -> [FormattingSpec a] -> [InlineParser m a] -> [InlineParser m Attributes] -> ReferenceMap -> [Tok] -> m (Either ParseError a) Source #

defaultInlineParser :: (Monad m, IsInline a) => InlineParser m a Source #

data IPState m Source #

type InlineParser m = ParsecT [Tok] (IPState m) (StateT Enders m) Source #

Specifies delimiters for formatting, e.g. strong emphasis.

getReferenceMap :: Monad m => InlineParser m ReferenceMap Source #

data FormattingSpec il Source #

Constructors

FormattingSpec |

Fields

- formattingDelimChar :: !Char

  Character that triggers formatting

- formattingIntraWord :: !Bool

  True if formatting can start/end in a word

- formattingIgnorePunctuation :: !Bool

  Treat punctuation like letters for purposes of computing can open/can close

- formattingSingleMatch :: Maybe (il -> il)

  Constructor to use for text between single delimiters.

- formattingDoubleMatch :: Maybe (il -> il)

  Constructor to use for text between double delimiters.

- formattingWhenUnmatched :: !Char

  Fallback when not matched.

#### Instances

Instances details

Show (FormattingSpec il) Source # |
Instance details Defined in Commonmark.Inlines Methods showsPrec :: Int -> FormattingSpec il -> ShowS Source # show :: FormattingSpec il -> String Source # showList :: [FormattingSpec il] -> ShowS Source #

defaultFormattingSpecs :: IsInline il => [FormattingSpec il] Source #

data BracketedSpec il Source #

Constructors

BracketedSpec |

Fields

- bracketedName :: !Text

  Name of bracketed text type.

- bracketedNests :: !Bool

  True if this can be nested.

- bracketedPrefix :: Maybe Char

  Prefix character.

- bracketedSuffixEnd :: Maybe Char

  Suffix character.

- bracketedSuffix :: ReferenceMap -> Text -> Parsec [Tok] () (il -> il)

  Parser for suffix after brackets. Returns a constructor. Second parameter is the raw key.

#### Instances

Instances details

Show (BracketedSpec il) Source # |
Instance details Defined in Commonmark.Inlines Methods showsPrec :: Int -> BracketedSpec il -> ShowS Source # show :: BracketedSpec il -> String Source # showList :: [BracketedSpec il] -> ShowS Source #

defaultBracketedSpecs :: IsInline il => [BracketedSpec il] Source #

data LinkInfo Source #

Constructors

LinkInfo |

Fields

- linkDestination :: !Text
- linkTitle :: !Text
- linkAttributes :: !Attributes
- linkPos :: !(Maybe SourcePos)

  Position of the reference link definition for references links.

#### Instances

Instances details

Show LinkInfo Source # |
Instance details Defined in Commonmark.ReferenceMap Methods showsPrec :: Int -> LinkInfo -> ShowS Source # show :: LinkInfo -> String Source # showList :: [LinkInfo] -> ShowS Source #

imageSpec :: IsInline il => BracketedSpec il Source #

linkSpec :: IsInline il => BracketedSpec il Source #

pLink :: ReferenceMap -> Text -> Parsec [Tok] s LinkInfo Source #

pLinkLabel :: Monad m => ParsecT [Tok] s m Text Source #

pLinkDestination :: Monad m => ParsecT [Tok] s m [Tok] Source #

pLinkTitle :: Monad m => ParsecT [Tok] s m [Tok] Source #

pEscaped :: Monad m => ParsecT [Tok] s m Tok Source #

processEmphasis :: IsInline a => [Chunk a] -> [Chunk a] Source #

processBrackets :: IsInline a => [BracketedSpec a] -> ReferenceMap -> [Chunk a] -> [Chunk a] Source #

pBacktickSpan :: Monad m => Tok -> InlineParser m (Either [Tok] [Tok]) Source #

normalizeCodeSpan :: Text -> Text Source #

withAttributes :: (IsInline a, Monad m) => InlineParser m a -> InlineParser m a Source #