Commonmark.ReferenceMap

commonmark-0.2.6.1: 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 #

Lookup table for link references.

Constructors

ReferenceMap |
Fields unReferenceMap :: Map Text [Dynamic]

#### Instances

Instances details

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

data LinkInfo #

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

emptyReferenceMap :: ReferenceMap #

insertReference #

Arguments

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

Insert a link reference into a reference map.

lookupReference #

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