CAML2HTML(1)

πŸ’– NAME πŸ’–

okay so bestie, welcome to the caml2html page β€” this is section 1 of the User Manuals, and it's literally all about pretty printing OCaml in html and latex ✨


🌸 SYNOPSIS 🌸

caml2html [Options...] files...

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does caml2html do? It pretty prints your OCaml source code as html or LaTeX files, and it's giving ✨aesthetic✨ the whole time. The pretty printing uses colors 🌈 and it adds tool-tips with type annotations if the matching .annot file is sitting right there. iykyk.

If you don't hand it any file arguments at all, it reads from standard input instead. And by default? It writes to standard output. no cap. πŸ’…


✨ OPTIONS ✨

okay here's the whole menu, don't skip any, every single one matters 🫢

  • -annotfilter {innermost|outermost} β€” pick your fighter: should the innermost or the outermost type annotations get used? (default is innermost)
  • -noannot β€” don't insert the type annotations that get read from .annot files. HTML output only, just so you know.
  • -ln β€” drop a line number at the beginning of every single line πŸ”’
  • -hc β€” comments get treated as raw HTML or LaTeX code. heads up tho: no newlines inside of tags ⚠️
  • -t β€” add a title to the HTML page πŸ‘‘
  • -body β€” output only the document's body, so you can shove it inside an existing document (peep -make-css and -make-latex-defs too πŸ‘€)
  • -nf β€” do not add footnotes to the HTML page
  • -inhead β€” use the default styling and place it in the <head> section of the document (this is the default when it applies)
  • -charset <charset> β€” specify which charset to use (default: iso-8859-1)
  • -css β€” use a separate CSS style file, style.css
  • -cssurl <URL> β€” use URL as the CSS
  • -inline β€” use inline styling (HTML only, and it's the default fallback if -inhead isn't applicable)
  • -ie7 β€” drop support for type annotations on Internet Explorer 6 and older πŸ’€
  • -notab β€” do not replace tabs by spaces
  • -tab <integer> β€” replace a tab by n spaces (default = 8)
  • -d <directory> β€” generate files in directory dir, rather than in the current directory
  • -o <filename> β€” output file
  • -make-css <filename> β€” create a CSS file with the default color definitions and then exit
  • -ext <NAME:CMD> β€” use the given external command CMD to handle comments that start with (*NAME. NAME must be a lowercase identifier. See EXAMPLES below πŸ‘‡
  • -latex β€” output LaTeX code instead of HTML.
  • -make-latex-defs <filename> β€” create a file containing the default LaTeX color definitions and matching highlighting commands, and exit. \usepackage{alltt,color} is not included.
  • -v β€” print version number to stdout and exit
  • -help | --help β€” Display options and exit.

πŸ“ EXAMPLES πŸ“

Process many files into a single file:

caml2html -o result.html *.mli *.ml

Process many files, and create one HTML page for each file:

caml2html *.ml

You can use HTML in the comments of the source file, for instance, to insert hyperlinks:

(* This is file1.ml.
   <a href="#file2.ml">This is a link to file2.ml</a>. *)

Note, that one HTML tag cannot span over several lines, and that the ordinary characters <, > and & must be written as &lt;, &gt; and &amp;. 🫠

Custom comment handlers β€” to implement an include directive for comments, use

caml2html -ext "include: xargs cat" example.ml

Then

(*include i.html *)
let f x = 2 * x + 1

produces

... contens of i.html ...
let f x = 2 * x + 1

as result. slay πŸ’…


πŸ’œ SEE ALSO πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

This manual page was written by Sylvain Le Gall <gildor@debian.org> and Hendrik Tews <hendrik@askra.de>, specifically for the Debian project (and may be used by others). legends fr fr 🫢


and that's the whole page bestie, mwah πŸ’‹ β€” this was the caml2html manual, dated May 2013, from the CAML2HTML era of things. go forth and pretty-print ur OCaml, main character energy only πŸŒŸπŸ’–