pandoc

A module providing a function to execute the Pandoc document converter.

Description:
  • A module providing a function to execute the Pandoc document converter.

Source:

Members

(inner, constant) defaults :PandocAdapterOptions

Description:
  • Default configuration for the pandoc function.

Source:

Default configuration for the pandoc function.

Type:
  • PandocAdapterOptions

Methods

(async, static) pandoc(config) → {Promise.<string>}

Description:
  • Executes the Pandoc binary to convert documents.

Source:
Parameters:
Name Type Description
config object

Configuration object for the pandoc execution.

Properties
Name Type Attributes Default Description
input string | stream.Readable <optional>
""

The input content to be processed by Pandoc. This can be a string which will be piped to Pandoc's stdin. If arguments to Pandoc specify an input file or URL, this can be an empty string.

args Array.<string> <optional>
[]

An array of command-line arguments to pass to the Pandoc binary (e.g., ['-f', 'markdown', '-t', 'html', 'input.md', '-o', 'output.html']).

options PandocAdapterOptions <optional>
{}

Additional options to pass which will be merged with the module's defaults.

Throws:

Rejects with an error if the Pandoc binary fails and allowErrors or allowStdoutError are false.

Type
Error | string
Returns:

A Promise that resolves with the stdout from the Pandoc binary.

Type
Promise.<string>

Type Definitions

PandocAdapterOptions

Source:
Properties:
Name Type Attributes Default Description
allowError boolean <optional>
false

If true, resolves the promise with the stdout even on Pandoc process error.

allowStdoutError boolean <optional>
false

If true, resolves with the stdout even if Pandoc writes to stderr.

execFile object <optional>

Options passed directly to the child_process.execFile function.

Properties
Name Type Attributes Default Description
maxBuffer number <optional>
5242880

The maximum amount of data (in bytes) allowed on stdout or stderr.

Type:
  • object