package higlo

  1. Overview
  2. Docs
Syntax highlighting library

Install

Dune Dependency

Authors

Maintainers

Sources

higlo-0.10.0.tar.bz2
md5=8e6ad939c2e0fd0640efd4a10e4137fd
sha512=fdccc8aaebe084f0b5e5dfbeabf5a1b94186ef023431492c2083d9949237761946c7e9e195a4a81fc0f72032224f4942d3adb2590aa22ff35804b2d9bc2ea902

doc/higlo/Higlo/Printers/index.html

Module Higlo.PrintersSource

Printers for the higlo tool.

Sourcetype printer = Lang.token list -> unit
Sourcetype classes = {
  1. bcomment : string;
  2. constant : string;
  3. directive : string;
  4. escape : string;
  5. id : string;
  6. keyword : int -> string;
  7. lcomment : string;
  8. numeric : string;
  9. string : string;
  10. symbol : int -> string;
  11. text : string;
  12. title : int -> string;
}

This structure defines the (X)HTML classes to use when producing XML.

Sourceval default_classes : classes

Default X(HTML) classes.

Sourceval token_to_xml : ?classes:classes -> Lang.token -> Xtmpl.Xml.tree

Map a token to an XML tree (just a <span class="...">code</span> node).

  • parameter classes

    is used to change the class names used in the generated node.

Sourceval token_to_xml_rewrite : ?classes:classes -> Lang.token -> Xtmpl.Rewrite.tree

Same as token_to_xml but return a Xtmpl.Rewrite.tree.

Sourceval to_xml : ?classes:classes -> lang:string -> string -> Xtmpl.Xml.tree list

to_xtmpl ~lang code gets the lexer associated to the language lang, uses it to retrieve a list of tokens (using the Lang.parse function) and maps these tokens to XML nodes. See token_to_xml about the classes parameter.

Sourceval to_xml_rewrite : ?classes:classes -> lang:string -> string -> Xtmpl.Rewrite.tree list

Same as to_xml but return a Xtmpl.Rewrite.tree.

Sourceval get_printer : string -> printer
  • raises Failure

    if the printer is not registered.

Sourceval register_printer : string -> printer -> unit
OCaml

Innovation. Community. Security.