readSymbolDocs(specifier: string,symbol: string,timeout?: number): Promise<SymbolDocsOutcome>
Returns deno doc's formatted documentation for one exported symbol.
Backs the --docs flag. Formatting is delegated to deno doc rather than
reimplemented, so the output matches what the user would see running the
tool themselves — including the module doc that --filter prints as a
preamble.
The positional form deno doc <specifier> <Symbol> is not used: it treats
the symbol as a file path and fails for jsr: specifiers, so --filter is
the only working spelling.
The subprocess colours its output whether or not it is talking to a
terminal, and it is talking to a pipe here by construction. The colour
decision is therefore taken from this process's stdout, so
--docs > notes.txt writes plain text while --docs on a terminal stays
readable.
Render the docs of one coder
Render the docs of one coder
import { assertEquals, assertStringIncludes } from "@std/assert"; import { readSymbolDocs } from "./discover.ts"; const docs = await readSymbolDocs( import.meta.resolve("../arp/mod.ts"), "arpData", ); assertEquals(docs.ok, true); if (docs.ok) assertStringIncludes(docs.text, "arpData");
Promise<SymbolDocsOutcome>
The formatted documentation, or why deno doc produced none