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?

2 Answers 2

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.

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. *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.