/**
* [[include:src/codecs/pandoc/README.md]]
*
* @module codecs/pandoc
*/
///
import stencila from '@stencila/schema';
import * as vfile from '../../util/vfile';
import { Codec, CommonDecodeOptions, CommonEncodeOptions } from '../types';
import * as Pandoc from './types';
export { InputFormat, OutputFormat } from './types';
/**
* Settings for derived codecs to use to
* customize the decoding behavior for particular formats.
* Not user options.
*/
export interface DecodeSettings {
pandocFormat?: Pandoc.InputFormat;
pandocArgs?: string[];
ensureFile?: boolean;
}
/**
* Settings for derived codecs to use to
* customize the encoding behavior for particular formats.
* Not user options.
*/
export interface EncodeSettings {
pandocFormat?: Pandoc.OutputFormat;
pandocArgs?: string[];
ensureFile?: boolean;
templatePath?: string;
useCiteproc?: boolean;
nodeInPng?: boolean;
nodeInAlt?: boolean;
nodeInLink?: boolean;
}
export declare class PandocCodec extends Codec implements Codec {
readonly mediaTypes: string[];
readonly extNames: string[];
/**
* Decode a `VFile` to a `stencila.Node`.
*
* @param file The `VFile` to decode
* @param options User options
* @param settings Pandoc settings used by derived codecs
* @returns A promise that resolves to a `stencila.Node`
*/
readonly decode: (file: vfile.VFile, _options?: CommonDecodeOptions, settings?: DecodeSettings) => Promise;
/**
* Encode a `stencila.Node` to a `VFile`.
*
* @param node The `stencila.Node` to encode
* @param options Additional arguments to pass to Pandoc
* @param ensureFile Ensure that the output is a real file (ie. not stdout?)
* @returns A promise that resolves to a `VFile`
*/
readonly encode: (node: stencila.Node, options?: CommonEncodeOptions, settings?: EncodeSettings) => Promise;
}
/**
* Run the Pandoc binary
*
* For performance, only filter using `pandoc-citeproc` is necessary.
*/
export declare function run(input: string | Buffer | Uint8Array, args: string[], useCiteproc?: boolean): Promise;
/**
* Decode a Pandoc `Meta` node to an `object`.
*
* This function also translates the names / values
* of Pandoc meta data (e.g. as used in template) to
* names / values used in Stencila schema.
*/
export declare function decodeMeta(meta: Pandoc.Meta, docPath?: string): Promise>;
/**
* Encode an `object` of metadata into a Pandoc `Meta` node
*/
export declare function encodeMeta(obj: {
[key: string]: any;
}): Pandoc.Meta;
/**
* Empty Pandoc element attributes
*/
export declare const emptyAttrs: Pandoc.Attr;