commonmark-0.3: Pure Haskell commonmark parser.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Commonmark.ReferenceMap

Synopsis

- newtype ReferenceMap = ReferenceMap {
  - unReferenceMap :: Map Text [Dynamic]
  }
- data LinkInfo = LinkInfo {
  - linkDestination :: !Text
  - linkTitle :: !Text
  - linkAttributes :: !Attributes
  - linkPos :: !(Maybe SourcePos)
  }
- emptyReferenceMap :: ReferenceMap
- insertReference :: Typeable a => Text -> a -> ReferenceMap -> ReferenceMap
- lookupReference :: Typeable a => Text -> ReferenceMap -> Maybe a

# Documentation

newtype ReferenceMap Source #

Lookup table for link references.

Constructors

ReferenceMap |

Fields

- unReferenceMap :: Map Text [Dynamic]

#### Instances

Instances details

Show ReferenceMap Source # |
Instance details Defined in Commonmark.ReferenceMap Methods showsPrec :: Int -> ReferenceMap -> ShowS Source # show :: ReferenceMap -> String Source # showList :: [ReferenceMap] -> ShowS 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 #

emptyReferenceMap :: ReferenceMap Source #

insertReference Source #

Arguments

:: Typeable a |
=> Text | Reference label
-> a |
-> ReferenceMap |
-> ReferenceMap |

Insert a link reference into a reference map.

lookupReference Source #

Arguments

:: Typeable a |
=> Text | Reference label
-> ReferenceMap |
-> Maybe a |

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`.