Another wrapper for pandoc, including automatic binary download.
npm i pandocjs
Because I couldn't any npm package to wrap pandoc for use
with JavaScript in node without requiring pandoc to be already installed
locally. This package installs the required binaries in the background,
independent in means of version and binaries from a locally pandoc
installation.
To convert the contents of an existing file (docbook format) info to a file in
markdown format, use the ConvertFileSync()
method:
const pandoc = require('pandocjs');
pandoc.ConvertFileSync('document.xml', 'docbook', 'document.md', 'gfm', { atxHeaders: true, wrap: 'preserve' });
There's plenty of JsDoc documentation included in this package (auto generated
calling pandoc
with the --help
, --list-input-formats
and
--list-output-formats
options). If your development environment provides
assistance by reading this information, all methods can be used pretty
straight forward (e.g. Visual Studio Code reads the JsDoc comments to
include it in the Intellisense feature).