Proposal: ocamldoc should generate a table of contents in each module page

Example is below. As you can see, the table of contents hyperlinks each name to the name’s documentation within the same page. This allows the reader to easily scan the TOC (which is helped by including the first line of the documentation comment in the TOC) to find what they’re looking for and jump down to it immediately. This is similar to what @dbuenzli suggested in First installment of Lwt’s new manual

This is a very bare-bones design, e.g. it would benefit a lot from actual icons indicating the kind of name (module, type, or value) instead of the bullet points we have currently. See the right-hand side of http://scala-lang.org/api/current/scala/io/index.html for an example.


Module Arg

module Arg : sig .. end

Parsing of command line arguments.

This module provides a general mechanism…

Contents
  • type spec - The concrete type describing the behavior associated with a keyword.
  • type key
  • ...
  • val parse - `Arg.parse speclist anon_fun usage_msg` parses the command line.
  • ...

#

type spec =

The concrete type describing the behavior associated with a keyword.

| Unit of (unit -> unit)

Call the function with unit argument

| Bool of (bool -> unit)

Call the function with a bool argument

...

#

type key = string

#

val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit

Arg.parse speclist anon_fun usage_msg parses the command line. speclist is a list of triples (key, spec, doc)

4 Likes

Created an issue on Mantis https://caml.inria.fr/mantis/view.php?id=7646

Incidentally, updated my mockup above to reflect my proposed redesign of docstring appearance for variant types ( https://caml.inria.fr/mantis/view.php?id=7634 ). I think this looks more like a literate programming style, which is nice, and less like raw source code comment. Compare with the original at https://caml.inria.fr/pub/docs/manual-ocaml/libref/Arg.html .