Skip to content

PromptScript API


Function: getFormatter()

getFormatter(name): Formatter

Defined in: formatters/src/standalone.ts:92

Get a formatter instance by name.

This is a convenience wrapper around FormatterRegistry.get() that throws a descriptive error if the formatter is not found.

Parameters

name

string

Formatter identifier (e.g., 'github', 'claude', 'cursor')

Returns

Formatter

Formatter instance

Throws

Error if the formatter is not registered

Example

import { getFormatter } from '@promptscript/formatters';

const github = getFormatter('github');
const output = github.format(ast);