MetaFormatter

commands. MetaFormatter

A formatter for a command metadata: its signature and description. Inherit from this class and override the desired methods to adjust the formatting.

Constructor

new MetaFormatter(codeFormatteropt)

Source:

Creates a new instance of this class.

Parameters:
Name Type Attributes Description
codeFormatter commands.CodeFormatter <optional>

Code formatter to use when formatting code samples.

Methods

format(meta) → {string}

Source:

Formats a command's metadata.

Parameters:
Name Type Description
meta commands.Meta

A command's metadata to format.

Returns:

The formatted command's metadata: its signature and description.

Type
string

formatBlockTag(text, tag) → {string}

Source:

Formats a block tag found in a command's description.

Parameters:
Name Type Description
text string

The text of the tag.

tag string

The tag name.

Returns:

The formatted block tag.

Type
string

formatCode(code) → {string}

Source:

Formats code typically found in an example tag in a command's description.

Parameters:
Name Type Description
code string

The raw code string to format.

Returns:

The formatted code.

Type
string

formatDesc(desc) → {string}

Source:

Formats a command's description.

Parameters:
Name Type Description
desc string

A command's raw description.

Returns:

The formatted command's description.

Type
string

formatInlineCode(code) → {string}

Source:

Formats inline code in a command's description.

Parameters:
Name Type Description
code string

The raw inline code string to format.

Returns:

The formatted code.

Type
string

formatInlineTag(text, tag) → {string}

Source:

Formats an inline tag found in a command's description.

Parameters:
Name Type Description
text string

The text of the tag.

tag string

The tag name.

Returns:

The formatted inline tag.

Type
string

formatName(name) → {string}

Source:

Formats the name of a command.

Parameters:
Name Type Description
name string

A command's name.

Returns:

The formatted command's name.

Type
string

formatParam(param) → {string}

Source:

Formats a parameter of a command.

Parameters:
Name Type Description
param commands.Param

A command's parameter.

Returns:

The formatted command's parameter.

Type
string

formatParams(params) → {string}

Source:

Formats the parameters of a command.

Parameters:
Name Type Description
params Array.<commands.Param>

A command's parameters.

Returns:

The formatted command's parameters.

Type
string

formatReturn($return) → {string}

Source:

Formats the return of a command.

Parameters:
Name Type Description
$return commands.Validate

A command's return specification.

Returns:

The formatted command's return.

Type
string

formatSignature(meta) → {string}

Source:

Formats the signature of a command.

Parameters:
Name Type Description
meta commands.Meta

A command's metadata.

Returns:

The formatted command's signature.

Type
string

formatTextBlock(text) → {string}

Source:

Formats a description text block. Either untagged or in a block tag.

Parameters:
Name Type Description
text string

The text block to format.

Returns:

The formatted text block.

Type
string