Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ocamldoc reference type constructors?

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?

like image 576
Ed McMan Avatar asked Nov 25 '25 06:11

Ed McMan


2 Answers

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.

like image 74
Thomas Avatar answered Nov 28 '25 17:11

Thomas


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. *)
like image 36
Daniel Bünzli Avatar answered Nov 28 '25 17:11

Daniel Bünzli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!