Copyright | (c) 2008-2010 Robert Greayer 2012 Brent Yorgey |
---|---|
License | GPL (see LICENSE) |
Maintainer | Brent Yorgey <byorgey@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Syntax highlighting.
- data HsHighlight
- _HsColourInline :: Prism' HsHighlight StylePrefs
- colourIt :: Bool -> String -> String
- litify :: String -> String
- type StylePrefs = [(String, String)]
- defaultStylePrefs :: StylePrefs
- getStylePrefs :: Maybe FilePath -> IO StylePrefs
- bakeStyles :: StylePrefs -> String -> String
- replaceBreaks :: String -> String
- colouriseCodeBlock :: HsHighlight -> Bool -> Block -> Block
- colourisePandoc :: HsHighlight -> Bool -> Pandoc -> Pandoc
Documentation
data HsHighlight Source #
Four modes for highlighting Haskell.
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.
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.