discount-0.1.1: Haskell bindings to the discount Markdown library.

Safe HaskellNone




This module is a thin wrapper around the discount Markdown-processing library, by David Parsons It exposes options that can be passed to the parser, as well as ByteString and Text interfaces to the parser itself.



data DiscountOption Source

An option flag to be passed to the discount parser.

Parser interface

parseMarkdown :: [DiscountOption] -> ByteString -> ByteStringSource

Convert the ByteString String input into well-formed HTML output. Note that an empty set of flags will not enable strict markdown behavior; instead, use compatOptions, which will cause discount to pass the markdown tests.

parseMarkdownUtf8 :: [DiscountOption] -> Text -> TextSource

As parseMarkdown, but taking Text values instead. Uses UTF-8 internally.

Parser options

noLinks :: DiscountOptionSource

Disables processing of links. Note that this will produce invalid HTML due to a bug in discount!

noImages :: DiscountOptionSource

Disables image processing. Note that this will produce invalid HTML due to a bug in discount!

noSmartyPants :: DiscountOptionSource

Disables SmartyPants processing. SmartyPants replaces quotes with curly quotes (except in code blocks), replaces (tm), (r), and (c) with the relevant symbols, and replaces ellipses and em/en-dashes with the appropriate symbols.

noHtml :: DiscountOptionSource

Disables raw HTML. Note that this will produce invalid HTML due to a bug in discount!

strict :: DiscountOptionSource

Disables both superscript and relaxed emphasis (see noRelaxedEmphasis).

noPseudoProtocols :: DiscountOptionSource

Disable pseudoprotocol wrapping. If this is not enabled, then links of the form [foo bar](class:glarch) will be replaced by <span class="glarch">foo bar</span>, and similarly for abbr:desc (uses <abbr title="desc">) and id:name (uses <a id="name">)

noSuperscripts :: DiscountOptionSource

Disables converstion of A^B into A<sup>B</sup>.

noRelaxedEmphasis :: DiscountOptionSource

Disables relaxed emphasis, allowing underscores to indicate emphasis in the middle of a word. With relaxed emphasis on (i.e. without this option) foo_bar_ will parse as foo_bar_. With it off, it parses as foo<em>bar</em>.

noTables :: DiscountOptionSource

Disables PHP Markdown Extra-style tables. See the documentation on PHP Markdown Extra at

noStrikethrough :: DiscountOptionSource

Disables ~~strikethrough~~.

noHeaders :: DiscountOptionSource

Disables Pandoc-style header processing. This does not disable headers like

 # or this

noDivQuotes :: DiscountOptionSource

Disables div-style quotes. Div-style quotes translates

 > %class%
 > foo

as <div class="class">foo</div>.

noAlphaLists :: DiscountOptionSource

Disables alphanumeric-ordered lists.

noDefinitionLists :: DiscountOptionSource

Disables definition lists.

tagText :: DiscountOptionSource

Process Markdown even inside an HTML tag.

safeLinks :: DiscountOptionSource

Only allow links that are local or that point to http, https, news, or ftp schemes.

tabStop :: DiscountOptionSource

Expand tabs to 4 spaces.

footnotes :: DiscountOptionSource

Enable Markdown Extra style footnotes. See For example:

 Here's some text with a footnote.[^1]

 [^1]: Here's a footnote with some text.

Footnotes have backlinks to their parent.

compatOptions :: [DiscountOption]Source

Disables all discount features not in the original Markdown spec: SmartyPants, relaxed emphasis, pseudo-protocols, strikethrough, headers, alphabetical lists, definition lists, superscripts, and tables.