cheapskate-0.1.0.5: Experimental markdown processor.

Safe Haskell | None
Language | Haskell2010

Cheapskate.Types

Synopsis

- data Doc = Doc Options Blocks
- data Block
  - = Para Inlines
  - | Header Int Inlines
  - | Blockquote Blocks
  - | List Bool ListType [Blocks]
  - | CodeBlock CodeAttr Text
  - | HtmlBlock Text
  - | HRule
- data CodeAttr = CodeAttr {
  - codeLang :: Text
  - codeInfo :: Text
  }
- data ListType
  - = Bullet Char
  - | Numbered NumWrapper Int
- data NumWrapper
  - = PeriodFollowing
  - | ParenFollowing
- data HtmlTagType
  - = Opening Text
  - | Closing Text
  - | SelfClosing Text
- type Blocks = Seq Block
- data Inline
  - = Str Text
  - | Space
  - | SoftBreak
  - | LineBreak
  - | Emph Inlines
  - | Strong Inlines
  - | Code Text
  - | Link Inlines Text Text
  - | Image Inlines Text Text
  - | Entity Text
  - | RawHtml Text
- type Inlines = Seq Inline
- type ReferenceMap = Map Text (Text, Text)
- data Options = Options {
  - sanitize :: Bool
  - allowRawHtml :: Bool
  - preserveHardBreaks :: Bool
  - debug :: Bool
  }

# Documentation

data Doc #

Structured representation of a document. The `Options` affect how the document is rendered by `toHtml`.

Constructors

Doc Options Blocks |

Instances

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

data Block #

Block-level elements.

Constructors

Para Inlines |
Header Int Inlines |
Blockquote Blocks |
List Bool ListType [Blocks] |
CodeBlock CodeAttr Text |
HtmlBlock Text |
HRule |

Instances

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

data CodeAttr #

Attributes for fenced code blocks. `codeLang` is the first word of the attribute line, `codeInfo` is the rest.

Constructors

CodeAttr |
Fields codeLang :: Text codeInfo :: Text

Instances

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

data ListType #

Constructors

Bullet Char |
Numbered NumWrapper Int |

Instances

Eq ListType # |
Methods (==) :: ListType -> ListType -> Bool # (/=) :: ListType -> ListType -> Bool #
Data ListType # |
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 :: (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 # |
Methods showsPrec :: Int -> ListType -> ShowS # show :: ListType -> String # showList :: [ListType] -> ShowS #

data NumWrapper #

Constructors

PeriodFollowing |
ParenFollowing |

Instances

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

data HtmlTagType #

Simple representation of HTML tag.

Constructors

Opening Text |
Closing Text |
SelfClosing Text |

Instances

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

type Blocks = Seq Block #

data Inline #

Inline elements.

Constructors

Str Text |
Space |
SoftBreak |
LineBreak |
Emph Inlines |
Strong Inlines |
Code Text |
Link Inlines Text Text |
Image Inlines Text Text |
Entity Text |
RawHtml Text |

Instances

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

type Inlines = Seq Inline #

type ReferenceMap = Map Text (Text, Text) #

data Options #

Rendering and parsing options.

Constructors

Options |
Fields sanitize :: Bool Sanitize raw HTML, link/image attributes allowRawHtml :: Bool Allow raw HTML (if false it gets escaped) preserveHardBreaks :: Bool Preserve hard line breaks in the source debug :: Bool Print container structure for debugging

Instances

Data Options # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Options -> c Options # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Options # toConstr :: Options -> Constr # dataTypeOf :: Options -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Options) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Options) # gmapT :: (forall b. Data b => b -> b) -> Options -> Options # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Options -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Options -> r # gmapQ :: (forall d. Data d => d -> u) -> Options -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Options -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Options -> m Options # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Options -> m Options # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Options -> m Options #
Show Options # |
Methods showsPrec :: Int -> Options -> ShowS # show :: Options -> String # showList :: [Options] -> ShowS #
Default Options # |
Methods def :: Options #