PtcRunner.Kernel.DocumentationLibrary (PtcRunner v0.14.0)

Copy Markdown View Source

Documentation pages embedded at compile time and served by ptc docs.

Each page is read from its repository source while the application compiles, so an installed executable serves documentation describing its own version without filesystem or network access. Page titles are derived from the source document rather than restated here.

The catalog is closed under linking. Every relative markdown link is rewritten to the ptc docs NAME command that serves the same document, and a link that resolves to no served page fails the compile — so a reader who follows what a shipped page prints reaches a page this executable actually carries.

This module is the only declaration of the served set. PtcRunner.Kernel.CommandContract derives the accepted page names from names/0, and the catalog order below is the order ptc docs lists.

Summary

Functions

Returns the embedded content of one page.

Returns the public listing of served pages, in catalog order.

Returns every served page name, in catalog order.

Functions

fetch(name)

@spec fetch(binary()) :: {:ok, binary()} | :error

Returns the embedded content of one page.

Examples

iex> {:ok, content} = PtcRunner.Kernel.DocumentationLibrary.fetch("agent-guide")
iex> String.starts_with?(content, "# Drive ptc as an agent")
true

iex> PtcRunner.Kernel.DocumentationLibrary.fetch("nonexistent")
:error

listing()

@spec listing() :: [%{optional(binary()) => binary() | non_neg_integer()}]

Returns the public listing of served pages, in catalog order.

Each entry carries the page name accepted by fetch/1, the title derived from the source document, and the exact embedded size in bytes.

names()

@spec names() :: [binary()]

Returns every served page name, in catalog order.