Commonmark.Types

commonmark-0.2.1.1: Pure Haskell commonmark parser.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Commonmark.Types

Synopsis

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

# Documentation

newtype Format #

Constructors

Format Text |

#### Instances

Instances details

Data Format # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Format -> c Format # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Format # toConstr :: Format -> Constr # dataTypeOf :: Format -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Format) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Format) # gmapT :: (forall b. Data b => b -> b) -> Format -> Format # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r # gmapQ :: (forall d. Data d => d -> u) -> Format -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Format -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Format -> m Format # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Format -> m Format # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Format -> m Format #
Show Format # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> Format -> ShowS # show :: Format -> String # showList :: [Format] -> ShowS #
Eq Format # |
Instance details Defined in Commonmark.Types Methods (==) :: Format -> Format -> Bool # (/=) :: Format -> Format -> Bool #

data ListSpacing #

Constructors

TightList |
LooseList |

#### Instances

Instances details

Data ListSpacing # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ListSpacing -> c ListSpacing # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ListSpacing # toConstr :: ListSpacing -> Constr # dataTypeOf :: ListSpacing -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ListSpacing) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListSpacing) # gmapT :: (forall b. Data b => b -> b) -> ListSpacing -> ListSpacing # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListSpacing -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListSpacing -> r # gmapQ :: (forall d. Data d => d -> u) -> ListSpacing -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ListSpacing -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing #
Show ListSpacing # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> ListSpacing -> ShowS # show :: ListSpacing -> String # showList :: [ListSpacing] -> ShowS #
Eq ListSpacing # |
Instance details Defined in Commonmark.Types Methods (==) :: ListSpacing -> ListSpacing -> Bool # (/=) :: ListSpacing -> ListSpacing -> Bool #
Ord ListSpacing # |
Instance details Defined in Commonmark.Types Methods compare :: ListSpacing -> ListSpacing -> Ordering # (<) :: ListSpacing -> ListSpacing -> Bool # (<=) :: ListSpacing -> ListSpacing -> Bool # (>) :: ListSpacing -> ListSpacing -> Bool # (>=) :: ListSpacing -> ListSpacing -> Bool # max :: ListSpacing -> ListSpacing -> ListSpacing # min :: ListSpacing -> ListSpacing -> ListSpacing #

data ListType #

Constructors

BulletList !Char |
OrderedList !Int !EnumeratorType !DelimiterType |

#### Instances

Instances details

Data ListType # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ListType -> c ListType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ListType # toConstr :: ListType -> Constr # dataTypeOf :: ListType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ListType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListType) # gmapT :: (forall b. Data b => b -> b) -> ListType -> ListType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ListType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ListType -> r # gmapQ :: (forall d. Data d => d -> u) -> ListType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ListType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ListType -> m ListType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ListType -> m ListType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ListType -> m ListType #
Show ListType # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> ListType -> ShowS # show :: ListType -> String # showList :: [ListType] -> ShowS #
Eq ListType # |
Instance details Defined in Commonmark.Types Methods (==) :: ListType -> ListType -> Bool # (/=) :: ListType -> ListType -> Bool #
Ord ListType # |
Instance details Defined in Commonmark.Types Methods compare :: ListType -> ListType -> Ordering # (<) :: ListType -> ListType -> Bool # (<=) :: ListType -> ListType -> Bool # (>) :: ListType -> ListType -> Bool # (>=) :: ListType -> ListType -> Bool # max :: ListType -> ListType -> ListType # min :: ListType -> ListType -> ListType #

data DelimiterType #

Constructors

Period |
OneParen |
TwoParens |

#### Instances

Instances details

Data DelimiterType # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DelimiterType -> c DelimiterType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DelimiterType # toConstr :: DelimiterType -> Constr # dataTypeOf :: DelimiterType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DelimiterType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DelimiterType) # gmapT :: (forall b. Data b => b -> b) -> DelimiterType -> DelimiterType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DelimiterType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DelimiterType -> r # gmapQ :: (forall d. Data d => d -> u) -> DelimiterType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DelimiterType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType #
Show DelimiterType # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> DelimiterType -> ShowS # show :: DelimiterType -> String # showList :: [DelimiterType] -> ShowS #
Eq DelimiterType # |
Instance details Defined in Commonmark.Types Methods (==) :: DelimiterType -> DelimiterType -> Bool # (/=) :: DelimiterType -> DelimiterType -> Bool #
Ord DelimiterType # |
Instance details Defined in Commonmark.Types Methods compare :: DelimiterType -> DelimiterType -> Ordering # (<) :: DelimiterType -> DelimiterType -> Bool # (<=) :: DelimiterType -> DelimiterType -> Bool # (>) :: DelimiterType -> DelimiterType -> Bool # (>=) :: DelimiterType -> DelimiterType -> Bool # max :: DelimiterType -> DelimiterType -> DelimiterType # min :: DelimiterType -> DelimiterType -> DelimiterType #

data EnumeratorType #

Constructors

Decimal |
UpperAlpha |
LowerAlpha |
UpperRoman |
LowerRoman |

#### Instances

Instances details

Data EnumeratorType # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EnumeratorType -> c EnumeratorType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EnumeratorType # toConstr :: EnumeratorType -> Constr # dataTypeOf :: EnumeratorType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EnumeratorType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumeratorType) # gmapT :: (forall b. Data b => b -> b) -> EnumeratorType -> EnumeratorType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r # gmapQ :: (forall d. Data d => d -> u) -> EnumeratorType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EnumeratorType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EnumeratorType -> m EnumeratorType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumeratorType -> m EnumeratorType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumeratorType -> m EnumeratorType #
Show EnumeratorType # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> EnumeratorType -> ShowS # show :: EnumeratorType -> String # showList :: [EnumeratorType] -> ShowS #
Eq EnumeratorType # |
Instance details Defined in Commonmark.Types Methods (==) :: EnumeratorType -> EnumeratorType -> Bool # (/=) :: EnumeratorType -> EnumeratorType -> Bool #
Ord EnumeratorType # |
Instance details Defined in Commonmark.Types Methods compare :: EnumeratorType -> EnumeratorType -> Ordering # (<) :: EnumeratorType -> EnumeratorType -> Bool # (<=) :: EnumeratorType -> EnumeratorType -> Bool # (>) :: EnumeratorType -> EnumeratorType -> Bool # (>=) :: EnumeratorType -> EnumeratorType -> Bool # max :: EnumeratorType -> EnumeratorType -> EnumeratorType # min :: EnumeratorType -> EnumeratorType -> EnumeratorType #

class (Monoid a, Show a, Rangeable a, HasAttributes a) => IsInline a where #

Methods

lineBreak :: a #

softBreak :: a #

str :: Text -> a #

entity :: Text -> a #

escapedChar :: Char -> a #

emph :: a -> a #

strong :: a -> a #

link #

Arguments

:: Text | Destination
-> Text | Title
-> a | Link description
-> a |

image #

Arguments

:: Text | Source
-> Text | Title
-> a | Description
-> a |

code :: Text -> a #

rawInline :: Format -> Text -> a #

#### Instances

Instances details

Rangeable (Html a) => IsInline (Html a) # |
Instance details Defined in Commonmark.Html Methods lineBreak :: Html a # softBreak :: Html a # str :: Text -> Html a # entity :: Text -> Html a # escapedChar :: Char -> Html a # emph :: Html a -> Html a # strong :: Html a -> Html a # link :: Text -> Text -> Html a -> Html a # image :: Text -> Text -> Html a -> Html a # code :: Text -> Html a # rawInline :: Format -> Text -> Html a #
(IsInline a, Semigroup a) => IsInline (WithSourceMap a) # |
Instance details Defined in Commonmark.SourceMap Methods lineBreak :: WithSourceMap a # softBreak :: WithSourceMap a # str :: Text -> WithSourceMap a # entity :: Text -> WithSourceMap a # escapedChar :: Char -> WithSourceMap a # emph :: WithSourceMap a -> WithSourceMap a # strong :: WithSourceMap a -> WithSourceMap a # link :: Text -> Text -> WithSourceMap a -> WithSourceMap a # image :: Text -> Text -> WithSourceMap a -> WithSourceMap a # code :: Text -> WithSourceMap a # rawInline :: Format -> Text -> WithSourceMap a #

class (Monoid b, Show b, Rangeable b, IsInline il, HasAttributes b) => IsBlock il b | b -> il where #

Methods

paragraph :: il -> b #

plain :: il -> b #

thematicBreak :: b #

blockQuote :: b -> b #

codeBlock :: Text -> Text -> b #

heading #

Arguments

:: Int | Level
-> il | text
-> b |

rawBlock :: Format -> Text -> b #

referenceLinkDefinition #

Arguments

:: Text | Label
-> (Text, Text) | Destination, title
-> b |

list :: ListType -> ListSpacing -> [b] -> b #

#### Instances

Instances details

IsInline (Html a) => IsBlock (Html a) (Html a) # |
Instance details Defined in Commonmark.Html Methods paragraph :: Html a -> Html a # plain :: Html a -> Html a # thematicBreak :: Html a # blockQuote :: Html a -> Html a # codeBlock :: Text -> Text -> Html a # heading :: Int -> Html a -> Html a # rawBlock :: Format -> Text -> Html a # referenceLinkDefinition :: Text -> (Text, Text) -> Html a # list :: ListType -> ListSpacing -> [Html a] -> Html a #
(IsBlock b a, IsInline b, IsInline (WithSourceMap b), Semigroup a) => IsBlock (WithSourceMap b) (WithSourceMap a) # |
Instance details Defined in Commonmark.SourceMap Methods paragraph :: WithSourceMap b -> WithSourceMap a # plain :: WithSourceMap b -> WithSourceMap a # thematicBreak :: WithSourceMap a # blockQuote :: WithSourceMap a -> WithSourceMap a # codeBlock :: Text -> Text -> WithSourceMap a # heading :: Int -> WithSourceMap b -> WithSourceMap a # rawBlock :: Format -> Text -> WithSourceMap a # referenceLinkDefinition :: Text -> (Text, Text) -> WithSourceMap a # list :: ListType -> ListSpacing -> [WithSourceMap a] -> WithSourceMap a #

newtype SourceRange #

Constructors

SourceRange |
Fields unSourceRange :: [(SourcePos, SourcePos)]

#### Instances

Instances details

Data SourceRange # |
Instance details Defined in Commonmark.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourceRange -> c SourceRange # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourceRange # toConstr :: SourceRange -> Constr # dataTypeOf :: SourceRange -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourceRange) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourceRange) # gmapT :: (forall b. Data b => b -> b) -> SourceRange -> SourceRange # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourceRange -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourceRange -> r # gmapQ :: (forall d. Data d => d -> u) -> SourceRange -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SourceRange -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange #
Monoid SourceRange # |
Instance details Defined in Commonmark.Types Methods mempty :: SourceRange # mappend :: SourceRange -> SourceRange -> SourceRange # mconcat :: [SourceRange] -> SourceRange #
Semigroup SourceRange # |
Instance details Defined in Commonmark.Types Methods (<>) :: SourceRange -> SourceRange -> SourceRange # sconcat :: NonEmpty SourceRange -> SourceRange # stimes :: Integral b => b -> SourceRange -> SourceRange #
Show SourceRange # |
Instance details Defined in Commonmark.Types Methods showsPrec :: Int -> SourceRange -> ShowS # show :: SourceRange -> String # showList :: [SourceRange] -> ShowS #
Eq SourceRange # |
Instance details Defined in Commonmark.Types Methods (==) :: SourceRange -> SourceRange -> Bool # (/=) :: SourceRange -> SourceRange -> Bool #
Ord SourceRange # |
Instance details Defined in Commonmark.Types Methods compare :: SourceRange -> SourceRange -> Ordering # (<) :: SourceRange -> SourceRange -> Bool # (<=) :: SourceRange -> SourceRange -> Bool # (>) :: SourceRange -> SourceRange -> Bool # (>=) :: SourceRange -> SourceRange -> Bool # max :: SourceRange -> SourceRange -> SourceRange # min :: SourceRange -> SourceRange -> SourceRange #
Rangeable (Html SourceRange) # |
Instance details Defined in Commonmark.Html Methods ranged :: SourceRange -> Html SourceRange -> Html SourceRange #

data SourcePos #

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.

#### Instances

Instances details

Data SourcePos |
Instance details Defined in Text.Parsec.Pos Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos # toConstr :: SourcePos -> Constr # dataTypeOf :: SourcePos -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) # gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #
Show SourcePos |
Instance details Defined in Text.Parsec.Pos Methods showsPrec :: Int -> SourcePos -> ShowS # show :: SourcePos -> String # showList :: [SourcePos] -> ShowS #
Eq SourcePos |
Instance details Defined in Text.Parsec.Pos Methods (==) :: SourcePos -> SourcePos -> Bool # (/=) :: SourcePos -> SourcePos -> Bool #
Ord SourcePos |
Instance details Defined in Text.Parsec.Pos Methods compare :: SourcePos -> SourcePos -> Ordering # (<) :: SourcePos -> SourcePos -> Bool # (<=) :: SourcePos -> SourcePos -> Bool # (>) :: SourcePos -> SourcePos -> Bool # (>=) :: SourcePos -> SourcePos -> Bool # max :: SourcePos -> SourcePos -> SourcePos # min :: SourcePos -> SourcePos -> SourcePos #

class Rangeable a where #

Methods

ranged :: SourceRange -> a -> a #

#### Instances

Instances details

Rangeable (Html SourceRange) # |
Instance details Defined in Commonmark.Html Methods ranged :: SourceRange -> Html SourceRange -> Html SourceRange #
Rangeable (Html ()) # |
Instance details Defined in Commonmark.Html Methods ranged :: SourceRange -> Html () -> Html () #
(Rangeable a, Monoid a, Show a) => Rangeable (WithSourceMap a) # |
Instance details Defined in Commonmark.SourceMap Methods ranged :: SourceRange -> WithSourceMap a -> WithSourceMap a #

type Attribute = (Text, Text) #

type Attributes = [Attribute] #

class HasAttributes a where #

Methods

addAttributes :: Attributes -> a -> a #

#### Instances

Instances details

HasAttributes (Html a) # |
Instance details Defined in Commonmark.Html Methods addAttributes :: Attributes -> Html a -> Html a #
HasAttributes (WithSourceMap a) # |
Instance details Defined in Commonmark.SourceMap Methods addAttributes :: Attributes -> WithSourceMap a -> WithSourceMap a #

class ToPlainText a where #

Methods

toPlainText :: a -> Text #

#### Instances

Instances details

ToPlainText (Html a) # |
Instance details Defined in Commonmark.Html Methods toPlainText :: Html a -> Text #
ToPlainText a => ToPlainText (WithSourceMap a) # |
Instance details Defined in Commonmark.SourceMap Methods toPlainText :: WithSourceMap a -> Text #