function readSymbolDocs
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.

Examples

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");

Parameters

specifier: string

A resolved specifier, e.g. jsr:@binstruct/arp or a path

symbol: string

The exported name to document, e.g. arpData

optional
timeout: number

Milliseconds before the subprocess is killed; defaults to TOOL_TIMEOUT

Return Type

The formatted documentation, or why deno doc produced none

Usage

import { readSymbolDocs } from "mod.ts";