BlogLiterately-0.8.1.2: A tool for posting Haskelly articles to blogs

Copyright(c) 2008-2010 Robert Greayer, 2012 Brent Yorgey
LicenseGPL (see LICENSE)
MaintainerBrent Yorgey <byorgey@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Text.BlogLiterately.Highlight

Description

Syntax highlighting.

Synopsis

Documentation

data HsHighlight Source

Four modes for highlighting Haskell.

Constructors

HsColourInline StylePrefs

Use hscolour and inline the styles.

HsColourCSS

Use hscolour in conjunction with an external CSS style sheet.

HsKate

Use highlighting-kate.

HsNoHighlight

Do not highlight Haskell.

colourIt :: Bool -> String -> String Source

Use hscolour to syntax highlight some Haskell code. The first argument indicates whether the code is literate Haskell.

litify :: String -> String Source

Prepend literate Haskell markers to some source code.

type StylePrefs = [(String, String)] Source

Style preferences are specified as a list of mappings from class attributes to CSS style attributes.

defaultStylePrefs :: StylePrefs Source

A default style that produces something that looks like the source listings on Hackage.

getStylePrefs :: Maybe FilePath -> IO StylePrefs Source

Read style preferences in from a file using the Read instance for StylePrefs, or return the default style if the file name is empty.

bakeStyles :: StylePrefs -> String -> String Source

Take a String of HTML produced by hscolour, and "bake" styles into it by replacing class attributes with appropriate style attributes.

replaceBreaks :: String -> String Source

Replace <br/> tags with newlines.

colouriseCodeBlock :: HsHighlight -> Bool -> Block -> Block Source

Transform a CodeBlock into a RawHtml block, where the content contains marked up Haskell (possibly with literate markers), or marked up non-Haskell, if highlighting of non-Haskell has been selected.

colourisePandoc :: HsHighlight -> Bool -> Pandoc -> Pandoc Source

Perform syntax highlighting on an entire Pandoc document.