Text.Highlighting.Kate.Format.HTML

highlighting-kate-0.6.2: Syntax highlighting

Copyright | Copyright (C) 2008-2011 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell98

Text.Highlighting.Kate.Format.HTML

Description

Formatters that convert a list of annotated source lines to HTML.

Synopsis

- formatHtmlInline :: FormatOptions -> [SourceLine] -> Html
- formatHtmlBlock :: FormatOptions -> [SourceLine] -> Html
- styleToCss :: Style -> String

# Documentation

formatHtmlInline :: FormatOptions -> [SourceLine] -> Html

Format tokens using HTML spans inside `code` tags. For example, A `KeywordTok` is rendered as a span with class `kw`. Short class names correspond to `TokenType`s as follows: `KeywordTok` = `kw`, `DataTypeTok` = `dt`, `DecValTok` = `dv`, `BaseNTok` = `bn`, `FloatTok` = `fl`, `CharTok` = `ch`, `StringTok` = `st`, `CommontTok` = `co`, `OtherTok` = `ot`, `AlertTok` = `al`, `FunctionTok` = `fu`, `RegionMarkerTok` = `re`, `ErrorTok` = `er`, `ConstantTok` = `cn`, `SpecialCharTok` = `sc`, `VerbatimStringTok` = `vs`, `SpecialStringTok` = `ss`, `ImportTok` = `im`, `DocumentationTok` = `do`, `AnnotationTok` = `an`, `CommentVarTok` = `cv`, `VariableTok` = `va`, `ControlFlowTok` = `cf`, `OperatorTok` = `op`, `BuiltInTok` = `bu`, `ExtensionTok` = `ex`, `PreprocessorTok` = `pp`, `AttributeTok` = `at`, `InformationTok` = `in`, `WarningTok` = `wa`. A `NormalTok` is not marked up at all.

formatHtmlBlock :: FormatOptions -> [SourceLine] -> Html

Format tokens as an HTML `pre` block. If line numbering is selected, this is put into a table row with line numbers in the left cell. The whole code block is wrapped in a `div` element to aid styling (e.g. the overflow-x property).

styleToCss :: Style -> String

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