⚠️ This is pre-release documentation for v3. For stable docs, visit v2.
Skip to content

@tmlmt/cooklang-parser / formatDiagnostics

Function: formatDiagnostics() ​

formatDiagnostics(diagnostics, source, label?): string

Convenience wrapper that formats all diagnostics in diagnostics and joins them with a blank line separator.

Parameters ​

diagnostics ​

Diagnostic[]

The diagnostics to render.

source ​

string

The original text returned in DiagnosticError.source or stored on DiagnosticError.source. Span positions refer to this string.

label? ​

string

Optional label shown in the location marker (default "recipe").

Returns ​

string

A multi-line plain-text string.