rhcarvalho

rhcarvalho

Uniform Elixir Documentation Experience - ExDoc as a Server

I recently came across HexSearch and yesterday found yet another interesting thread on improving the experience of HexDocs (Introduce search across all of HexDocs · Issue #1811 · elixir-lang/ex_doc · GitHub). The latter is apparently aiming at changes at the ExDoc level, requiring documentation for a package to be regenerated to benefit from improvements.

Elixir documentation is generally top notch, specially for the most used libraries, however one of the things that I noticed with time is that the ExDoc/HexDocs experience can be quite inconsistent depending on the version of ExDoc used to build docs for a package.

That means clicking links that take you to another package may change the UI drastically, both aesthetically and functionally. Navigating to older versions of documentation for a given page has a similar effect.

There are advantages to having the documentation built once and never changing for a given release, but there are advantages to having a single “ExDoc server” that can render documentation for arbitrary versions of arbitrary packages, too.

Has this server model been explored in public earlier? I haven’t found any references yet.

I am not really familiar with how ExDoc works and how easy/compatible would it be for a recent version of ExDoc to render docs for arbitrarily old packages – but does that sound plausible and worth investigating further?

In broad lines, I’m thinking a server that would be able to take a Hex package (or perhaps even a Git repo), generate documentation, cache it and serve that. Any updates to the server functionality and design would apply to all pages consistently.

First Post!

christhekeele

christhekeele

ExDoc works primarily by extracting documentation chunks from compiled BEAM code. That means that you should be able to take any BEAM project that compiles, and the same version of :ex_doc, and generate more modern documentation from it.

The additional complexity I foresee is that mix projects can and do customize their generated documentation extensively via configuration in their mix.exs or their rebar3.config files, so you will need to make sure your approach honors them.

This could be as simple as a script that checks out each project, adds your desired version of :ex_doc/unlocks :ex_doc and related dependencies and resets them to your desired version, and tries to do normal docgen!

I think so!

Most Liked

christhekeele

christhekeele

Not without messing with dependencies, exactly—the compiled BEAM code by necessity includes the compiled dependencies, if you have access to a completely compiled BEAM project by definition you’ve got the deps in there.

As far as ex_doc supporting being pointed to a folder with precompiled BEAM deps, I don’t know if it has an API for that. I would be surprised, as it’s optimized for the library owner’s developer experience, but you may be able to muck around with internals!

Even if it does support that, I would suggest the full-build solution anyhow; remember that ex_doc does not JUST look at the compiled code, but also the project’s mix/rebar configuration for extra pages, module groups, etc; to build the resulting site. Mix/Rebar build metadata like that don’t end up in the compiled release, so you don’t have enough artifacts to re-generate a full ex_doc site for a library just from precompiled files alone.

Where Next?

Popular in Discussions Top

tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement