Skip to content

renderHelp

renderHelp(name, help): string

Defined in: packages/core/src/kernel/lib/render-help.ts:49

Render a BinHelp struct into deterministic markdown.

string

The bin name, used for the NAME heading (<name> - <summary>).

BinHelp

Structured help content to render.

string

Deterministic markdown with a trailing newline.

Output is ordered NAME · SYNOPSIS · DESCRIPTION · OPTIONS · EXAMPLES · SEE ALSO, matching the man-page convention. Sections are omitted when their source field is absent; empty arrays (flags: [], etc.) are treated as absent so a bin with no flags doesn’t produce a blank OPTIONS heading. Output always ends with a trailing newline.

This powers the man bin and --help output across the coreutils presets — rendering stays in one place so every bin looks the same.

import { renderHelp } from '@fishnet/core'
const md = renderHelp('cat', {
summary: 'concatenate and print files',
usage: 'cat [FILE]...',
flags: [{ name: 'n', type: 'boolean', description: 'number output lines' }],
examples: ['cat file.txt', 'cat a b > c'],
seeAlso: ['head', 'tail'],
})
// md begins with "# NAME\n\ncat - concatenate and print files"