-
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
Improve navigation (TOC, index, etc.) #127
Comments
I think a sidebar showing the modules of the package in a hierarchy as docre does it (though preferably foldable) would go a long way. As it is, it's too easy to get lost. |
Note that
Regarding module indexes and For modules indexes if you take the current Personally I think that a side bar (that collapses if the page is not wide enough) with only the |
(Or you can simply hit the package link which is more predictable) |
I'm currently working on UX features for the documentation generated by odoc in some of my libraries and here are my thoughts about indices and search:
Once I build something more complete I would like to contribute to |
I think this is a good idea. Perhaps even one level is enough. Also, combined with this approach, take a look at the pages of cppreference. Specifically, notice the 'crumb bar' at the top, which shows you your path to the current page, and if you hover over it you can immediately go to all other options. The current odoc path is completely static, as seen here for example. With these 2 things combined, I think we would have complete awareness of the user's current position. |
As the topic is being discussed a bit: I generally like sidebars. I know some people think they waste space, but the truth is, on a modern laptop display, you can't actually make the text very wide before it becomes unreadable anyway. Humans do very poorly when columns of text get much wider than 70 or 90 characters, as they start having trouble tracking position in text by eye. (I have this problem myself). So, even given a quite large font, you have space available, and having the table of contents and index right there immediately at hand is very useful, because it means you can skip around quickly. Being able to skip around quickly means a document can have a lot more detail in it without slowing down experts. So it's an overall win. |
Note that this was designed on purpose. The module name tells you were you are you have the
Don't make too much assumptions about the width of computer screen. I work with a 13'' screen with an 80 columns editor on the left and a browser for the remaining space on the right, a lot of designs that people propose do not work at all for me (e.g. the given here |
It is pretty simple to rig things so that the sidebar disappears when the width is too narrow. Indeed, adjusting to different types of displays is essential these days anyway because of mobile use. |
Plugging this as a simple example of OCaml docs with a disappearing sidebar: http://aantron.github.io/lambda-soup/ |
@aantron That looks quite nice! It even reflows the text once you get narrow enough! (Though I will note that the examples get cut off at really narrow widths rather than developing horizontal scrolling, but this is a quibble.) |
You can see how the sidebar adds so much in terms of context-awareness. |
The rendered Lwt draft from last year also has a disappearing sidebar: http://ocsigen.org/lwt/manual-draft/Lwt.html. It's not quite as good because I didn't spend as much time tweaking the widths and margins (it was just a quick thrown-together CSS to show the draft). In both cases, the sidebar contains a TOC that appears after the module introductory material in the markup. When the screen is wide enough, it displays as a sidebar. Once the screen is narrow, it appears inline near the beginning of the page. |
Let me chime in with what I have thought about docs navigations. This might be a Dune/Odig issue, but I'm curious to see if this could be handled at odoc level. Currently, Dune and Odig generates the following pages based on the source (although it seems that odig currently does not support .mld manuals yet):
Dune's It is a matter of UX affordance, especially if we want to encourage people to write manuals. For packages such as Dune which have many pages on its manual it would be a nightmare to navigate on without a sidebar (I think it would be great if we could get Dune to dump readthedocs for dune+odoc). Say I arrive at this page from a Google search of Lwt_result: It is not immediately clear what other pages are available. It hurts discoverability of the package. The only navigational elements in the page is the "Up" link (how high?). The breadcrumb helps but only so much. That's why I don't exactly agree with this opinion:
I think we shouldn't be satisfied with only "good enough". If we can cut one or two clicks it can improve the UX by a whole lot. I hate going to shopping malls where direction signs (e.g. to elevators, restrooms, etc.) are rare. It's not fun having to find and ask a security or to go to the mall's entrance just to find out the restroom was a few steps away from where I originally was. Another problem with having Hence, my proposal is to just put the global navigation elements into the sidebar. The Now, another question is what needs to be on the sidebar. The one I have in my mind is as follows:
As you can see, 1 and 3-5 are global to the package and 2 is local to the page. This can make the sidebar horizontally long and needs scrolling, but I don't see anything wrong with that. IMO It's better to have a reasonably comprehensive "map" available at all times. As an aside, it would also be great if odoc has a configuration mechanism as to how the manual pages are ordered (either accepting sexp/json config file or via numbered filenames (e.g. Would love to hear people's thoughts on this. |
I agree that the current state is probably not sufficient for easy navigation, but I think that putting other modules in the sidebar will just make the sidebar unusable. Most packages where the navigation is currently difficult have a lot of modules in them, and an alphabetical list of them is basically useless. All it will do is fill the sidebar with noise that makes it hard to find the useful local links. I'm generally not a fan of side-bars, the small space makes it difficult for them to provide useful information. They are rarely used relative to the amount of screen space they occupy and they detract from the experience of reading the main content of the page. There is a reason that websites have pretty much universally abandoned them as navigation elements. They're okay for showing the structure of the current page (although they're less intrusive if they are on the right rather than the left of the page) but their not a good way to show the structure of the whole site. The only real way to make large packages easily navigable is for the authors of those libraries to actually write a decent landing page, and to write good module title comments that include links to other related modules. I think we should focus on making it easier for them to do that rather than adding too many built-in navigation elements. The UX reasoning behind up links/breadcrumbs and landing pages is a good one. On the modern internet clicking away to a separate landing page is quick. It allows you to use the whole landing page to display the structure of the content, and doesn't waste space on the other pages trying to display this structure. However, currently that experience is not great with odoc. It is hard to write a good landing page, as odoc doesn't offer any real assistance for things like making lists of modules. The "up" link and breadcrumbs also don't give a great indication of where you actually are at the moment -- it is not that clear in your example that you are on the API documentation of version N of the lwt library/package -- which, as you say, is painful if you arrive via an external link. |
Quite in agreement with @lpw25 but:
I'm not sure what you mean by that, |
I disagree that it would be useless, but I understand what you mean. That is why I propose the list of modules to be at the bottom of the sidebar, and the local links and manual links above it, hence it will present the most relevant information first. With enough visual cues I think it can be made intuitive. Having it there is also friendlier for
This should be solvable with collapsible and toggle-able sidebar. When I say that, I was referring to something along the lines of Elixir's generated docs (e.g. for the Phoenix web framework). Granted, even in the Elixir one the module listing is hidden in the
I'm not sure how much of this is true for documentation sites for libraries though, I still think that it is more common to have sidebars in doc pages (Elixir, Ruby, Python, Sphinx, Javadoc). I'd love to be proven wrong. That said, if there is an alternative other than sidebars that could include global navigation elements then I guess I'll be okay with it (dropdown menus?). I also don't mind it being on the right side, fwiw.
Eh, humans are lazy... I think if odoc could handle creating a tidy list of links for them then authors can have one less thing to worry about and focus more on creating nice content. |
Well, I'd forgotten that |
I'm fine with closing this. Having a page with identifier indexes would be nice though I will open an issue for it. |
We already have #52 tracking this. |
We need:
odig already generates many different kinds of index. For an example, see docs.mirage.io.
cc @yawaramin @bluddy @pmetzger
The text was updated successfully, but these errors were encountered: