highlighting-kate-0.2.7.1: Syntax highlightingSource codeContentsIndex
Text.Highlighting.Kate
Portabilityportable
Stabilityalpha
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Description

This helper module exports the main highlighting and formatting functions.

A typical application will combine a highlighter and a formatter:

 main = do
   code <- getContents
   case highlightAs "ruby" code of
         Right result -> putStrLn $ renderHtmlFragment $ 
                         formatAsXHtml [OptNumberLines] "ruby" result
         Left  err    -> error $ "Could not parse input: " ++ err
Synopsis
highlightAs :: String -> String -> Either String [SourceLine]
languages :: [String]
languagesByExtension :: String -> [String]
languagesByFilename :: FilePath -> [String]
formatAsXHtml :: [FormatOption] -> String -> [SourceLine] -> Html
data FormatOption
= OptNumberLines
| OptNumberFrom Int
| OptLineAnchors
| OptTitleAttributes
| OptDetailed
defaultHighlightingCss :: String
type SourceLine = [LabeledSource]
type LabeledSource = ([String], String)
highlightingKateVersion :: String
Documentation
highlightAsSource
:: StringLanguage syntax
-> StringSource code to highlight
-> Either String [SourceLine]Either error message or result
Highlight source code using a specified syntax definition.
languages :: [String]Source
List of supported languages.
languagesByExtension :: String -> [String]Source
Returns a list of languages appropriate for the given file extension.
languagesByFilename :: FilePath -> [String]Source
Returns a list of languages appropriate for the given filename.
formatAsXHtmlSource
:: [FormatOption]Options
-> StringLanguage
-> [SourceLine]Source lines to format
-> Html
Format a list of highlighted SourceLines as XHtml.
data FormatOption Source
Options for formatters.
Constructors
OptNumberLinesNumber lines
OptNumberFrom IntNumber of first line
OptLineAnchorsAnchors on each line number
OptTitleAttributesInclude title attributes
OptDetailedInclude detailed lexical information in classes. (By default, only the default style is included. This option causes output to be more verbose.)
defaultHighlightingCss :: StringSource
type SourceLine = [LabeledSource]Source
A line of source, list of labeled source items.
type LabeledSource = ([String], String)Source
A pair consisting of a list of attributes and some text.
highlightingKateVersion :: StringSource
Produced by Haddock version 2.6.0