-
Notifications
You must be signed in to change notification settings - Fork 90
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
Stop using <details> #92
Comments
Problem with JavaScript is that it doesn't work (unless maybe inlined ?) through the |
Fair point. |
😭 |
That said I was never really convinced about this kind of folding. I think linking to another page is fine (with the ability to inline via an attribute annotation if wanted). |
Open-by-default would be really nice for searchability. |
This would also be a workaround for this Safari bug, an interaction between |
See https://bugs.webkit.org/show_bug.cgi?id=173876 Safari doesn't correctly render elements styled in rem units, when they follow <details> elements. Probably the right way to deal with this is to stop emitting <details> elements. However, since we will also change the stylesheet, this commit changes the CSS for now. See also ocaml/odoc#92.
Hi, I strongly recommend either not using E.g., if I link to https://ocaml.janestreet.com/ocaml-core/v0.9/doc/base/Base/List/index.html#val-fold_until the page that loads has no mention of the function. If I don't know about the In short, in-page links should be honoured. That doesn't happen with closed |
Were you considering loading the contents of |
I think we will move away from folding completely. We should probably either always inline, with the option of adding a tag or attribute in the |
FTR. they are opened by default, and there is an odoc cmdline flag to change the default. On top of that there is a variety of tags |
Personally, I'm in favor of keeping folding but moving away from It's not clear to me how to make things work without either folding or inlining a module type S = sig
module N : sig
module type T
end
module M : T
end
module Impl : sig
module type T = sig
type t = int
end
end
module Foo : sig
...
include S with module M := Impl
...
end
type s = Foo.M.t If you have You would need to have a page specifically for So if you can't use a link you must either inline the contents of the
or you use folding. |
Actually, I'd like to adjust my above example from an example of why you can't use links for However, I'm still be very keen to keep support for folding. For certain interfaces it gives a superior browsing experience, allowing you to see all elements of a module when necessary whilst still hiding repetitive details when not needed. I don't mind it not being the default, I would just like to provide the option for people. |
Nowadays this is usually done with a TOC panel on the left or right side of the page, see e.g. https://hexdocs.pm/elixir/List.html#delete/2 Folding is IMHO not a good solution because as was noted, it does not honour in-page links. When I give someone a direct link to a function, I want them to be able to jump to it straightaway, without having to open folds. Btw, I'm not saying get rid of all folds, just saying fold in such a way that we honour in-page links. E.g. we can fold any sections which we know don't contain anchors, like the body of a doc comment. |
You can make folding respect in-page links with a little JavaScript and some more precise names for ids. The issue that can't be solved this way is "find in page", which is Daniel's main concern with them. Personally, I think that trade-off is worth making for some APIs, and I would like to have a proper search widget for finding items on the page at some point anyway. |
Note that it's a trade-off only if you don't have a TOC panel on the left. If you do, you get the best of both worlds–fast overview of the entire module, and no need for folds hence both in-page links and search work. |
I don't really see how a TOC helps much. They tend to either contain all elements of a module, and are thus so long as to be fairly useless, like: https://doc.rust-lang.org/std/primitive.u128.html or they only contain top-level user specified sections, which is useful but doesn't help much with browsing the modules contents, like: https://hackage.haskell.org/package/base-4.10.1.0/docs/Control-Monad.html |
Any new thoughts about this? If we do remove details I think we should not inline included modules by default. Looking at libraries like Base this would significantly damage the navigation experience as many modules implement well-known interfaces (Comparable, Monad, etc) that most people will want to skip anyway. |
You mean including module types right ? Not module implementations.
I wouldn't be so sure about this. I remember being highly irritated by OO doc generators where you always had to look into a class and then all the upper classes. If you have everything on a page you know anything you might use will be here and this knowledge combined with on-page search allows for efficient access and queries. |
In the absence of any satisfactory replacement for |
Yes, I meant module types, thanks for correcting. In my opinion, it happens in OO because not many interfaces are as "generic" and "fundamental" as in OCaml. I would say that most people who use Core/Base know what constitutes a "Stringable", "Comparable" or "Hashable" type. Seeing all their items is just distracting (to me). A counterargument is that code completion in editors, utop and tools like ocp-browser typically include all items inline. We could choose to be consistent with them. |
Is it really ? I think it's actually wrong to have these as generic documentation bits and they are absolutely not a distraction (to me). To take your first two example interfaces I would certainly like to know at some point which syntax is parsed/emited and how the value is compared exactly. |
@rizo: thanks for the clarification. Adding an Again, I don't think anything else needs to be done now. |
(And for example when I include |
@dbuenzli I understand your point of view and in a way agree with it. But the problem you describe seems to be orthogonal to the question of whether includes should or should not be inlined. Allow me to clarify. When a generic module is inlined (as you are suggesting should happen) the generic description will be inlined too, for an abstract type (some I'm aware this is not contributing to the decision for this issue and agree with @trefis that the current situation is acceptable. |
Yes but IIRC you can have both: And again the doc page acting as a real index of what is in accessible from the module is a useful property in my opinion. |
You can and that's what I was trying to describe :). But my conclusion is different, because both the included value and the overridden one would be accessible, it's better to not have the original one inlined. For example the following: module type X = sig
val hello : unit -> string
(** Generic hello. *)
end
include X
val hello : unit -> string
(** My better hello. *) Since the included |
Two remarks:
|
I'm not sure I understand this, isn't the shadowed item included in the signature? Or did you mean "shouldn't"?
I personally don't see any issues with this. The included generic functions (regardless of inlining) will never be able to describe exactly how it works for a concrete type (but having it is still useful). In fact functions with default implementation can be redefined for efficiency. |
My bad, I forgot a word, I indeed meant "shouldn't". |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The crappy behaviour of The sensible behaviour also seems to have been added to the HTML spec, although I don't know whether or not that makes it likely to be adopted in the other browsers. |
Which are currently used for includes.
As @dbuenzli pointed out in the past,
<details>
are terrible to link into and to search a page. We should just avoid them (and use JS instead? :( )The text was updated successfully, but these errors were encountered: