pandoc-server is a web
server that can perform pandoc conversions. It can be used either
as a running server or as a CGI program.
as a CGI program, rename it (or symlink it) as
pandoc-server.cgi. (Note: if
you symlink it, you may need to adjust your webserver’s
configuration in order to allow it to follow symlinks for the CGI
All pandoc functions are run in the PandocPure monad, which ensures that they can do no I/O operations on the server. This should provide a high degree of security. This security does, however, impose certain limitations:
PDFs cannot be produced.
Filters are not supported.
Resources cannot be fetched via HTTP.
Any images, include files, or other resources needed for the document conversion must be explicitly included in the request, via the
filesfield (see below under API).
- HTTP port on which to run the server. Default: 3030.
Timeout in seconds, after which a conversion is killed. Default: 2.
pandoc-serveris run as a CGI program, this option can be set via the
- Print this help.
- Print version.
The root (
accepts only POST requests. It returns a converted document in one
of the following formats, depending on Accept headers:
If the result is a binary format (e.g.,
docx) and the content is
returned as plain text or JSON, the binary will be base64
The body of the POST request should be a JSON object, with the
following fields. Only the
text field is required; all of
the others can be omitted for default values. When there are
several string alternatives, the first one given is the
The document to be converted. Note: if the
fromformat is binary (e.g.,
textshould be a base64 encoding of the document.
The input format, possibly with extensions, just as it is specified on the pandoc command line.
The output format, possibly with extensions, just as it is specified on the pandoc command line.
shift-heading-level-by(integer, default 0)
Increase or decrease the level of all headings.
indented-code-classes(array of strings)
List of classes to be applied to indented Markdown code blocks.
Extension to be applied to image sources that lack extensions (e.g.
tab-stop(integer, default 4)
Tab stop (spaces per tab).
Specifies what to do with insertions, deletions, and comments produced by the MS Word “Track Changes” feature. Only affects docx input.
List of strings to be regarded as abbreviations when parsing Markdown. See
standalone(boolean, default false)
If true, causes a standalone document to be produced, using the default template or the custom template specified using
template. If false, a fragment will be produced.
String contents of a document template (see Templates in
pandoc(1)for the format).
Variables to be interpolated in the template. (See Templates in
dpi(integer, default 96)
Dots-per-inch to use for conversions between pixels and other measurements (for image sizes).
Text wrapping option: either
"auto"(automatic hard-wrapping to fit within a column width),
"preserve"(insert newlines where they are present in the source), or
"none"(don’t insert any unnecessary newlines at all).
columns(integer, default 72)
Column width (affects text wrapping and calculation of table column widths in plain text formats)
table-of-contents(boolean, default false)
Include a table of contents (in supported formats).
toc-depth(integer, default 3)
Depth of sections to include in the table of contents.
strip-comments(boolean, default false)
Causes HTML comments to be stripped in Markdown or Textile source, instead of being passed through to the output format.
Specify the style to use for syntax highlighting of code. Standard styles are
"tango". Alternatively, the path of a
.themewith a KDE syntax theme may be used (in this case, the relevant file contents must also be included in
files, see below).
Embed images, scripts, styles and other resources in an HTML document using
dataURIs. Note that this will not work unless the contents of all external resources are included under
html-q-tags(boolean, default false)
<q>elements in HTML instead of literal quotation marks.
ascii(boolean, default false)
Use entities and escapes when possible to avoid non-ASCII characters in the output.
reference-links(boolean, default false)
Create reference links rather than inline links in Markdown output.
Determines whether link references and footnotes are placed at the end of the document, the end of the section, or the end of the block (e.g. paragraph), in certain formats. (See
setext-headers(boolean, default false)
Use Setext (underlined) headings instead of ATX (
#-prefixed) in Markdown output.
Determines how top-level headings are interpreted in LaTeX, ConTeXt, DocBook, and TEI. The
"default"value tries to choose the best interpretation based on heuristics.
number-sections(boolean, default false)
Automatically number sections (in supported formats).
number-offset(array of integers)
Offsets to be added to each component of the section number. For example,
will cause the first section to be numbered “2” and the first subsection “2.1”;
[0,1]will cause the first section to be numbered “1” and the first subsection “1.2.”
Determines how math is represented in HTML.
listings(boolean, default false)
listingspackage to format code in LaTeX output.
incremental(boolean, default false)
If true, lists appear incrementally by default in slide shows.
Heading level that deterimes slide divisions in slide shows. The default is to pick the highest heading level under which there is body text.
section-divs(boolean, default false)
Arrange the document into a hierarchy of nested sections based on the headings.
Determines how email addresses are obfuscated in HTML.
Prefix to be added to all automatically-generated identifiers.
Prefix to be added to the title in the HTML header.
Reference doc to use in creating
--reference-docfor details. The contents of the file must be included under
Cover image for EPUB. The contents of the file must be included under
Path of file containing Dublin core XML elements to be used for EPUB metadata. The contents of the file must be included under
epub-chapter-level(integer, default 1)
Heading level at which chapter splitting occurs in EPUBs.
epub-subdirectory(string, default “EPUB”)
Name of content subdirectory in the EPUB container.
epub-fonts(array of file paths)
Fonts to include in the EPUB. The fonts themselves must be included in
Determines how ipynb output cells are treated.
allmeans that all of the data formats included in the original are preserved.
nonemeans that the contents of data cells are omitted.
bestcauses pandoc to try to pick the richest data block in each output cell that is compatible with the output format.
citeproc(boolean, default false)
Causes citations to be processed using citeproc. See Citations in
bibliography(array of file paths)
Files containing bibliographic data. The contents of the files must be included in
CSL style file. The contents of the file must be included in
Determines how citations are formatted in LaTeX output.
files(JSON mapping of file paths to base64-encoded strings)
Any files needed for the conversion, including images referred to in the document source, should be included here. Binary data must be base64-encoded. Textual data may be left as it is, unless it is also valid base 64 data, in which case it will be interpreted that way.
behaves like the root endpoint, except for these two points:
- It accepts a JSON array, each element of which is a JSON object like the one expected by the root endpoint.
- It returns a JSON array of results. (It will not return plain text or octet-stream, like the root endpoint.)
This endpoint can be used to convert a sequence of small snippets in one request.
accepts a GET request and returns the pandoc version as a plain or
JSON-encoded string, depending on Accept headers.
endpoint accepts a GET request with the following query
from(optional string, default is
to(optional string, default is
standalone(optional boolean, default is
It returns a JSON object with fields
version. This endpoint is
designed to support the Babelmarkhttps://babelmark.github.io website.