-
-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Having good documentation is an import responsibility of any programming language, especially one hoping to provide good DX. While the Gleam documentation format is quite good, and in some areas is better than any other format I could find, it falls short in a few other areas. What follows is a discussion of issues with the current format and recommendations on how they might be fixed based on research into the documentation formats of other programming languages. These issues are listed from most important to least.
-
"Functions" and "Types" sections are appended to the bottom of the left-side bar. On smaller screens, these may be rendered off-screen and the reader may not be aware they exist at all. Even if the reader realizes they exist, they will likely have to scroll to find what they're looking for.
Llanguages that provide convenient in-page navigation form two camps:
-
Elixir-style tree/accordion sidebar.
The sidebar features three tiers: Modules, Sections, Members. The interface has a "drill-down" mechanic where you click a Module name to see its Sections, then click a Section to see its Members. Go also uses this format, Ruby/Rubydoc uses a similar accordion/tree structure for drilling-down through namespace hierarchies.
-
The left-side bar features a list of modules (called "namespaces" in Clojure) whereas the right-side "Table of Contents" box contains Sections (e.g. "Types") and Members (e.g. "Vec"). This style is also used by Dart, .NET, Typescript, and inconsistently by Django, Kotlin, and others.
The sun/moon light-mode/dark-mode toggle also suffers from being off-screen at the bottom of the sidebar; could afford to be relocated.
-
-
Space utilization. While many other documentation formats suffered from too little whitespace and appearing jumbled, Gleam's documentation format sometimes struggles to fit content into the viewport.
Upon review, I found four specific issues:
- Permanent, mostly empty header bar
- Large font for function names
- Large gaps between functions
- Content is narrow (not conveyed well by image taken on a small laptop screen 😅)
At 680px, the actual content section of Gleam's documentation format is narrower than all others surveyed with the exception of Clojure's. Another item taking up significant space is the "chase"; the pink squiggle under titles. However, this adds a nice character to an otherwise rather sterile page, and so I don't recommend changing it.
Recommendations:
- Move current header bar content into the left-side bar, remove the header bar.
- Reduce function name font size
- Reduce gaps between functions
- Widen content section slightly. The content section width of other formats is generally >750px (Elixir's is 829px, Rust's is 936px).
-
Search. Almost every format, including Erlang's own rather minimal format, feature a search functionality (exceptions: Clojure, Node.js, Deno). While today's Gleam packages are small and easy to navigate, this might not stay the case, meaning that a search feature may become immensely useful.
-
Lack links to module source. The only languages surveyed whose documentation format included this feature were Elixir and Rust. However, being able to jump to a module's source code rather than to one of its types or functions is useful.
-
Packages cannot specify a logo image. The only language surveyed that provides this functionality is Elixir (e.g. Ecto). However, I feel that it gives a nice, personal touch to documentation pages.


