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

Safe HaskellNone
LanguageHaskell98

Text.Discount

Contents

Description

This module is a thin wrapper around the discount Markdown-processing library, by David Parsons http://www.pell.portland.or.us/~orc/Code/discount/. It exposes options that can be passed to the parser, as well as ByteString and Text interfaces to the parser itself.

Synopsis

Documentation

data DiscountOption #

An option flag to be passed to the discount parser.

Parser interface

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

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 -> Text #

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

Parser options

noLinks :: DiscountOption #

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

noImages :: DiscountOption #

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

noSmartyPants :: DiscountOption #

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 :: DiscountOption #

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

strict :: DiscountOption #

Disables both superscript and relaxed emphasis (see noRelaxedEmphasis).

noPseudoProtocols :: DiscountOption #

Disable pseudoprotocol wrapping. If this is not enabled, then links of the form foo bar 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 :: DiscountOption #

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

noRelaxedEmphasis :: DiscountOption #

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 :: DiscountOption #

Disables PHP Markdown Extra-style tables. See the documentation on PHP Markdown Extra at http://michelf.com/projects/php-markdown/extra/#table.

noStrikethrough :: DiscountOption #

Disables ~~strikethrough~~.

noHeaders :: DiscountOption #

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

This
====
# or this

noDivQuotes :: DiscountOption #

Disables div-style quotes. Div-style quotes translates

> %class%
> foo

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

noAlphaLists :: DiscountOption #

Disables alphanumeric-ordered lists.

noDefinitionLists :: DiscountOption #

Disables definition lists.

tagText :: DiscountOption #

Process Markdown even inside an HTML tag.

safeLinks :: DiscountOption #

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

tabStop :: DiscountOption #

Expand tabs to 4 spaces.

footnotes :: DiscountOption #

Enable Markdown Extra style footnotes. See http://michelf.com/projects/php-markdown/extra/#footnotes. 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] #

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