skylighting- syntax highlighting library

Safe HaskellNone




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

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 TokenTypes as follows: KeywordTok = kw, DataTypeTok = dt, DecValTok = dv, BaseNTok = bn, FloatTok = fl, CharTok = ch, StringTok = st, CommentTok = 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 Source #

Format tokens as an HTML pre block. Each line is wrapped in a div with the class ‘source-line’. The whole code block is wrapped in a div element to aid styling (e.g. the overflow-x property). If line numbering is selected, this surrounding div is given the class ‘number-source’, and the resulting html will display line numbers thanks to the included css. Note that the html produced will always include the line numbers as the 'data-line-number' attribute. See the documentation for formatHtmlInline for information about how tokens are encoded.

styleToCss :: Style -> String Source #

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