-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
odoc sometimes force-inlines includes #1162
Comments
You mention "library interface files" If so, try naming the library something different (ie, keep |
Yes precisely, I'm using the same names for the library and file on purpose:
I understand why this double interface would cause problems though. I'm declaring a module whose type isn't exported directly, it is only exported through a separate include. Unifying these could prove challenging, but I believe it is a common enough pattern to be worth looking into. |
OK, so that explains why you're seeing that behaviour. Odoc will inline includes if doesn't know of a non-hidden path to the module/type being included. In this case there's no link to module Sigs = Sigs
(** This doesn't render correctly *)
module Err1 : Sigs.PARTIAL_ORDERED_TYPE
open Sigs
(** Neither does this *)
module Err2 : PARTIAL_ORDERED_TYPE
include module type of Sigs
(** This does though *)
module Ok : PARTIAL_ORDERED_TYPE and that should fix all the expansions to be what you're expecting. |
This reverts commit 2fcf6e5.
A solution mentioned by @jonludlam in codex-semantics-library/patricia-tree#10 is to use For the toy example here, just add the tags to the module type in (** some doc
@canonical Lib.TYPE *)
module type TYPE = sig
type t
(** Doc of t*)
end
(** A supermodule of {!TYPE}, with partial ordering
@canonical Lib.PARTIAL_ORDERED_TYPE *)
module type PARTIAL_ORDERED_TYPE = sig
include TYPE (** @closed *)
val partial_compare : t -> t -> int option
(** order of t *)
end And make sure those module types are available in module Err1 : Sigs.PARTIAL_ORDERED_TYPE
(** This now renders as expected, hurray! *)
open Sigs
module Err2 : PARTIAL_ORDERED_TYPE
(** Same for this one *)
include module type of Sigs
(** including the actual signatures is still required obviously, but @canonical tags allow changing their names *) |
I've run into an issue where odoc force inlines my includes in the generated doc. Its quite brittle, so I'm not sure what exactly causes it, but here is a minimal example.
Lets say i have a library
Lib
with the following files:sigs.ml
(no mli needed, but adding it does not seem to change the behavior)Lib.ml
andLib.mli
, I'll just put the mli here:Then for some reason
Ok
andErr1 / Err2
are rendered very differently.Ok
is rendered with the correct signature and the closed include shows up correctly in its documentation, whereas theErr
s are rendered assig ... end
and the include has been inlined in their documentation.Is there any way around this? I would really like to use one of the
Err
style signature (in the full example, my modules aren't actually defined in the top library filelib.ml
, they are in another filemodules.ml
, in which I would like to justopen Sigs
, not have toinclude
it, and theninclude
bothSigs
andModules
inLib
).The text was updated successfully, but these errors were encountered: