The text scripts guide renders — the script contract and the batteries a
script is handed — read at the call from the docs the release keeps.
One home
What a script must implement and what it is handed are written once, as the
moduledocs of YmerNode.Script and YmerNode.Script.Context and the docs
beneath them, and this module renders those bytes: a client reading the guide
and a developer reading the published docs read the same text, and a contract
change moves one text. Code.fetch_docs/1 is the reader, which is why the
release keeps the BEAM Docs chunk that mix release strips by default —
strip_beams: [keep: ["Docs"]] in mix.exs, and the one reason it is there.
One section is the guide's own, and it comes last: Applications this release carries, read from the running node at the call. A release carries only the Erlang/OTP applications its dependencies need, and that set moves with every release line, so a list written in the docs would be a copy nobody keeps in step — and a client reaches the guide alone, so the list has to be in it.
The rendering half stands on its own as render_modules/1, with no tail:
YmerNode.Scripts.PackageDocs renders a promised package's docs through it,
so a package's page reads exactly as the guide does and carries the
applications list once, in the guide, rather than at the end of every answer.
Whole or refused
A build without the chunk is answered with a refusal naming the build, never
a partial guide: render/1 stops at the first module whose docs are missing
and renders none of them. A dev checkout runs from _build/dev, where the
chunk always exists.
The shape
One markdown text. Each module contributes its name as a heading, its
moduledoc, then its documented types, callbacks and functions — grouped in
that order, each group sorted by line in the source rather than by name, so
the text reads the way its author laid it out — under a heading carrying the
signature. Hidden docs (@doc false) and undocumented entries are left out,
as the published docs leave them out.
Summary
Functions
Renders the guide over modules — the two contract modules by default — and
ends it with the applications the running node has loaded.
Renders the docs of modules alone — each module's name as a heading, its
moduledoc, then its documented types, callbacks and functions — with no
applications tail. render/1 is this plus the tail; YmerNode.Scripts.PackageDocs
is this under a header of its own.
Functions
Renders the guide over modules — the two contract modules by default — and
ends it with the applications the running node has loaded.
Answers {:ok, markdown}, or {:error, {:docs_missing, detail}} naming the
first module whose docs this build does not carry.
Renders the docs of modules alone — each module's name as a heading, its
moduledoc, then its documented types, callbacks and functions — with no
applications tail. render/1 is this plus the tail; YmerNode.Scripts.PackageDocs
is this under a header of its own.
Answers {:ok, markdown}, or {:error, {:docs_missing, detail}} naming the
first module whose docs this build does not carry, rendering none of them.