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.
Synopsis
- data HsHighlight
- _HsColourInline :: Prism' HsHighlight StylePrefs
- colourIt :: Bool -> Text -> String
- litify :: Text -> Text
- 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. |
Instances
Eq HsHighlight Source # | |
Defined in Text.BlogLiterately.Highlight (==) :: HsHighlight -> HsHighlight -> Bool # (/=) :: HsHighlight -> HsHighlight -> Bool # | |
Data HsHighlight Source # | |
Defined in Text.BlogLiterately.Highlight gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsHighlight -> c HsHighlight # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HsHighlight # toConstr :: HsHighlight -> Constr # dataTypeOf :: HsHighlight -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HsHighlight) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsHighlight) # gmapT :: (forall b. Data b => b -> b) -> HsHighlight -> HsHighlight # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsHighlight -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsHighlight -> r # gmapQ :: (forall d. Data d => d -> u) -> HsHighlight -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsHighlight -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsHighlight -> m HsHighlight # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsHighlight -> m HsHighlight # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsHighlight -> m HsHighlight # | |
Show HsHighlight Source # | |
Defined in Text.BlogLiterately.Highlight showsPrec :: Int -> HsHighlight -> ShowS # show :: HsHighlight -> String # showList :: [HsHighlight] -> ShowS # |
colourIt :: Bool -> Text -> 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.