cheapskate-highlight-0.1.0.0: Code highlighting for cheapskate

Safe HaskellNone
LanguageHaskell2010

Cheapskate.Highlight

Contents

Synopsis

Highlighting

highlightDoc :: Doc -> Doc Source

Highlight a document by replacing code blocks with raw HTML blocks.

By default, the rest of the attribute line (i.e. all words after the first word after ~~~ or ```) get added as classes to the container block of the code.

highlightDocWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Doc -> Doc Source

The function is given code block's language (i.e. the 1st word of the attribute line after ~~~ or ```) and the rest of the attribute line.

If you don't want the classes to be derived from the attribute line, make the function set containerClasses to [].

Options

data FormatOptions :: *

Options for formatting source code.

Constructors

FormatOptions 

Fields

numberLines :: Bool

Number lines

startNumber :: Int

Number of first line

lineAnchors :: Bool

Anchors on each line number

titleAttributes :: Bool

Html titles with token types

codeClasses :: [String]

Additional classes for Html code tag

containerClasses :: [String]

Additional classes for Html container tag (pre or table depending on numberLines)

Styles

styleToCss :: Style -> String

Returns CSS for styling highlighted code according to the given style.