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

MaintainerBrent Yorgey <byorgey@gmail.com>
Safe HaskellSafe-Infered

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 -> StringSource

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

litify :: String -> StringSource

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 :: StylePrefsSource

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

getStylePrefs :: FilePath -> IO StylePrefsSource

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 -> StringSource

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

replaceBreaks :: String -> StringSource

Replace <br/> tags with newlines.

colouriseCodeBlock :: HsHighlight -> Bool -> Block -> BlockSource

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 -> PandocSource

Perform syntax highlighting on an entire Pandoc document.