My grain of salt here.
TL;DR: Perhaps, just maybe, a PR achieving three different things is too big and the whole change can be made incrementally. But overall I’m greatly in favour of the proposal.
Edit, TL;DR: @MononcQc just gave an awesome detail of this whole thing : Comments on merge request OTP/#8026 - Change documentation to use ExDoc - #40 by MononcQc
Markdown >>> XML
A million times. It is an ubiquitous markup language widely used across all IT communities in the world. It is pleasant and very easy to use for both the reader as well as the writer, without tools. This makes the support burden way smaller:
- I don’t need to install xml tools in my system I’ve ever needed for anything else only to build documentation for OTP. Markdown comes out of the box with the building system in my local build, without global installs.
- It is much easier for new contributors, as there is no DTD to learn, no
<>
terminators to be careful with. If I want to just simply throw a quick PR fixing some typos it’s no effort for me at all, which in the current documentation I’ve been put off from way too many times. - It is readable even without pretty printing, just reading markdown in a raw text editor shows me clearly the structure of the text, XML takes a huge cognitive overload to find closing tags and not be confused by nesting levels. Yes yes there are tools that help with XML, but that’s the point, XML is so unfriendly it needs tools.
- I just wrote this whole answer using Markdown, as we all did here, for example.
ExDoc
Yes, the great benefit of this is unifying forces across the whole BEAM ecosystem, and I think this is such a very very big point to be made worth the effort of hassling with tooling for a moment.
Docs in code or separately
Here I agree there’s a difference in the purpose of the documentation. One example that I come back to very often is gen_statem
(because I’m a great fan of it!), the reference manual docs Erlang -- gen_statem and the user guide docs Erlang -- gen_statem Behaviour.
The first is details about functions, and that fits perfectly as headers to the functions I’m interested in to begin with. The maintainer of the function must know what is the contract of the function and how to use it and be able to explain so, together with the function. Details I don’t want in the documentation can be just comments into the code, the internal hows of functions are not something that users of the function need to read, only maintainers of the function, so, precisely, maintainers will have a better use of it if these are good old usual comments within the function.
The second is a user guide about how to use the whole thing, and that would be a big clutter to have within the module doc. ExDoc
fortunately supports adding extras, see how rebar3_ex_doc
itself does it: rebar3_ex_doc/rebar.config at cb6bc51928c0b4efd2b1081781466b9822f8e403 · starbelly/rebar3_ex_doc · GitHub
specs
Removing -spec
s? Wait why? I haven’t seen that one and I’d strongly vote against, but maybe there’s a good reason, dunno, why is it happening?
What (I think) we could do
- Split the PR. One PR migrating XML to Markdown. Is there any tool that would build the same documentation looks as we already have it, but having docs written in markdown as annotations to functions? I think that to me would be the largest benefit by far. Makes reading and writing documentation a lot easier and pleasant.
- Use ExDoc, keeping the distinction between reference manuals and user guides as it already exists, and get a single tool to benefit the whole BEAM ecosystem. Over time contribute to ExDoc to make it more powerful, extensible, and all it might be needed, and again have the whole BEAM ecosystem benefit from it. Having it eventually extensible might also help address custom formatting as desired by the OTP team.