commonmark-0.1.0.1: Pure Haskell commonmark parser.

Safe HaskellSafe
LanguageHaskell2010

Commonmark.Parser

Contents

Synopsis

Documentation

commonmark Source #

Arguments

:: IsBlock il bl 
=> String

Name or path of input

-> Text

Commonmark text input

-> Either ParseError bl

Result or error

Parse a commonmark document using the core syntax elements. To produce HTML, instantiate bl with Html () (see Html. If you want to add syntax extensions or run the parser in a monadic context, use commonmarkWith. If you want to operate on tokenized input, use parseCommonmarkWith.

commonmarkWith Source #

Arguments

:: (Monad m, IsBlock il bl, IsInline il) 
=> SyntaxSpec m il bl

Defines syntax

-> String

Name or path of input

-> Text

Commonmark text input

-> m (Either ParseError bl)

Result or error

Like commonmark, but allows specifying a custom syntax and a monadic context (since some syntax extensions may only be defined in certain monads, e.g. an extension for include files may require IO).

parseCommonmarkWith Source #

Arguments

:: (Monad m, IsBlock il bl, IsInline il) 
=> SyntaxSpec m il bl

Defines syntax

-> [Tok]

Tokenized commonmark input

-> m (Either ParseError bl)

Result or error

Parse a tokenized commonmark document using specified syntax elements. Use tokenize to convert Text into [Tok].

Exported from Text.Parsec.Error

data ParseError #

The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function parse. ParseError is an instance of the Show and Eq classes.

Instances
Eq ParseError 
Instance details

Defined in Text.Parsec.Error

Show ParseError 
Instance details

Defined in Text.Parsec.Error