3

I'm trying to refer to a type constructor in ocamldoc.

For example:

type x = Awesome | Boring

And later we want to refer to one of the constructors in some documentation:

(** {!Awesome} is a really great constructor for {!x}.  You should definitely use it instead of {!Boring}. *)

ocamldoc complains:

Warning: Element Awesome not found
Warning: Element Boring not found

Is there a way to reference type constructors such that ocamldoc can link to the corresponding type?

Thomash
  • 6,339
  • 1
  • 30
  • 50
Ed McMan
  • 521
  • 2
  • 15

2 Answers2

4

You cannot directly cross-link to a type constructor. However, you can link to the type itself:

(** {{!x}Awesome} is a really great constructor for {!x}. *)

If you want to have something more precise, you can write a small ocamldoc plugin to overwrite the html_of_Ref method.

Thomas
  • 5,047
  • 19
  • 30
3

AFAIK that's not possible. You can see the kind of references that can be made with this syntax here. However what you can do is :

(** {{!x}[Awesome]} that will at least bring to {!x} by clicking on it. *)
Daniel Bünzli
  • 5,119
  • 20
  • 21