Class: ContentFormatter

ContentFormatter(contents) → {string}

Aggregates multiple formatted contents into a single output.

Constructor

new ContentFormatter(contents) → {string}

Parameters:
Name Type Description
contents Array

An array of content objects.

Source:
Returns:

The aggregated content.

Type
string

Methods

aggregate(contents) → {string|Object}

Aggregates the provided contents based on the specified format.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated content in the specified format.

Type
string | Object

aggregateJson(contents) → {string}

Aggregates contents into JSON format.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated JSON string.

Type
string

aggregateMarkdown(contents) → {string}

Aggregates contents into Markdown format, including a Table of Contents.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated Markdown content.

Type
string

sanitizeAnchor(filePath) → {string}

Sanitizes a file path to create a markdown anchor.

Parameters:
Name Type Description
filePath string

The file path to sanitize.

Source:
Returns:

The sanitized anchor string.

Type
string

ContentFormatter()

Class representing a content formatter.

Constructor

new ContentFormatter()

Source:

Methods

aggregate(contents) → {string|Object}

Aggregates the provided contents based on the specified format.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated content in the specified format.

Type
string | Object

aggregateJson(contents) → {string}

Aggregates contents into JSON format.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated JSON string.

Type
string

aggregateMarkdown(contents) → {string}

Aggregates contents into Markdown format, including a Table of Contents.

Parameters:
Name Type Description
contents Array

An array of content objects to aggregate.

Source:
Returns:

The aggregated Markdown content.

Type
string

sanitizeAnchor(filePath) → {string}

Sanitizes a file path to create a markdown anchor.

Parameters:
Name Type Description
filePath string

The file path to sanitize.

Source:
Returns:

The sanitized anchor string.

Type
string