-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Top-level doc-comments of module types are discarded #478
Comments
Thanks @craigfe - good timing, I'm just working on this right now - I'll get back with findings! |
This behaviour is deliberate. The top-level comment in a module type or module is treated as a description of the module type or module itself. This is how you can have descriptions of top-level modules. In other words: module M : sig
(** module [M] *)
...
end and (** module [M] *)
module M : sig
...
end are equivalent. This behaviour is possibly unnecessary for non-top-level modules, so perhaps it should be removed. Or perhaps we should remove it for module types and keep it for modules. Even if we removed that behaviour, you still wouldn't get the behaviour that you want with an |
I propose the following solution to this:
This is mostly a change of behaviour for module type definitions, which would no longer get the first comment of their contents as part of their main documentation. |
After doing some testing, here is the current behavior and what would change with @lpw25's suggestion: (** c1 *)
module M : sig
(** c2 *)
...
end Currently:
Changes:
(** c1 *)
module type T = sig (* c2 *) ... end
(** c3 *)
module M : T Currently:
This shouldn't change. This is the reason for not changing the behavior of module types in the first case. (** c1 *)
module type T = sig (* c2 *) ... end
module M : sig
include T (** @inline *)
end Currently:
Changes: Render This doesn't apply if any of (** c3 *)
module M : sig
(** c4 *)
include T
(** c5
@inline *)
end However, |
With the following set of files:
the generated documentation for
Main
looks like the following:i.e. the top-level doc-comment has been lost. As a workaround, it's possible to move top-level doc comments to the
.mli
file, but this splits the documentation across two files unnecessarily.Is this rendering behaviour intentional?
The text was updated successfully, but these errors were encountered: