pandoc-server(1)
π NAME π
pandoc-server β web server exposing pandoc API. Okay bestie, this page is from the Pandoc Userβs Guide, and itβs basically the group-chat rundown of the pandoc-server(1) situation. No cap.
π¦ SYNOPSIS π¦
pandoc-server [options]
π DESCRIPTION π
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.
To use pandoc-server 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 script.)
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).
π₯ OPTIONS π₯
--port NUMβ HTTP port on which to run the server. Default:3030.--timeout SECONDSβ Timeout in seconds, after which a conversion is killed. Default:2. Whenpandoc-serveris run as a CGI program, this option can be set via thePANDOC_SERVER_TIMEOUTenvironment variable.--helpβ Print this help.--versionβ Print version.
π API π
πΈ Root endpoint πΈ
The root (/) endpoint accepts only POST requests.
π Response π
It returns a converted document in one of the following formats (in order of preference), depending on the Accept header:
application/octet-streamtext/plainapplication/json
If the result is a binary format (e.g., epub or docx) and the content is returned as plain text or JSON, the binary will be base64 encoded.
If a JSON response is given, it will have one of the following formats. If the conversion is not successful:
{ "error": string with the error message }
If the conversion is successful:
{ "output": string with textual or base64-encoded binary output,
"base64": boolean (true means the "output" is base64-encoded),
"messages": array of message objects (see below) }
Each element of the βmessagesβ array will have the format
{ "message": string,
"verbosity": string (either "WARNING" or "INFO") }
π Request π
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 default.
text(string) β The document to be converted. Note: if thefromformat is binary (e.g.,epubordocx), thentextshould be a base64 encoding of the document.from(string, default"markdown") β The input format, possibly with extensions, just as it is specified on thepandoccommand line.to(string, default"html") β The output format, possibly with extensions, just as it is specified on thepandoccommand line.shift-heading-level-by(integer, default0) β 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.default-image-extension(string) β Extension to be applied to image sources that lack extensions (e.g.".jpg").metadata(JSON map) β String-valued metadata.tab-stop(integer, default4) β Tab stop (spaces per tab).track-changes("accept"|"reject"|"all") β Specifies what to do with insertions, deletions, and comments produced by the MS Word βTrack Changesβ feature. Only affectsdocxinput.abbreviations(file path) β List of strings to be regarded as abbreviations when parsing Markdown. See--abbreviationsinpandoc(1)for details.typst-inputs(JSON map) β Inputs to be provided to the typst evaluator. See--typst-inputinpandoc(1)for details.standalone(boolean, defaultfalse) β If true, causes a standalone document to be produced, using the default template or the custom template specified usingtemplate. If false, a fragment will be produced.template(string) β String contents of a document template (see Templates inpandoc(1)for the format).variables(JSON map) β Variables to be interpolated in the template. (See Templates inpandoc(1).)dpi(integer, default96) β Dots-per-inch to use for conversions between pixels and other measurements (for image sizes).wrap("auto"|"preserve"|"none") β 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, default72) β Column width (affects text wrapping and calculation of table column widths in plain text formats)table-of-contents(boolean, defaultfalse) β Include a table of contents (in supported formats).toc-depth(integer, default3) β Depth of sections to include in the table of contents.list-of-figures(boolean, defaultfalse) β Include a list of figures (in supported formats).list-of-tables(boolean, defaultfalse) β Include a list of tables (in supported formats).strip-comments(boolean, defaultfalse) β Causes HTML comments to be stripped in Markdown or Textile source, instead of being passed through to the output format.syntax-highlighting("default"|"none"|"idiomatic"|style) β The method used for code syntax highlighting. Setting a specific style causes highlighting to be performed with the internal highlighting engine, using KDE syntax definitions and styles. The"idiomatic"method uses a format-specific highlighter if one is available, or the default style if the target format has no idiomatic highlighting method. Setting this option tononedisables all syntax highlighting. The"default"method uses a format-specific default.
Standard styles are "pygments" (the default), "kate", "monochrome", "breezeDark", "espresso", "zenburn", "haddock", and "tango". Alternatively, the path of a .theme with a KDE syntax theme may be used (in this case, the relevant file contents must also be included in files, see below).
The default for HTML, EPUB, Docx, Ms, Man, and LaTeX output is to use the internal highlighter with the default style; Typst output relies on Typstβs own syntax highlighting system by default.
embed-resourcesβ Embed images, scripts, styles and other resources in an HTML document using data URIs. Note that this will not work unless the contents of all external resources are included underfiles.html-q-tags(boolean, defaultfalse) β Use<q>elements in HTML instead of literal quotation marks.ascii(boolean, defaultfalse) β Use entities and escapes when possible to avoid non-ASCII characters in the output.reference-links(boolean, defaultfalse) β Create reference links rather than inline links in Markdown output.reference-location("document"|"section"|"block") β 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. (Seepandoc(1)under--reference-location.)setext-headers(boolean, defaultfalse) β Use Setext (underlined) headings instead of ATX (#-prefixed) in Markdown output.top-level-division("default"|"part"|"chapter"|"section") β 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, defaultfalse) β Automatically number sections (in supported formats).number-offset(array of integers) β Offsets to be added to each component of the section number. For example,[1]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.βhtml-math-method("plain"|"webtex"|"gladtex"|"mathml"|"mathjax"|"katex") β Determines how math is represented in HTML.listings(boolean, defaultfalse) β Use thelistingspackage to format code in LaTeX output.incremental(boolean, defaultfalse) β If true, lists appear incrementally by default in slide shows.slide-level(integer) β 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, defaultfalse) β Arrange the document into a hierarchy of nested sections based on the headings.email-obfuscation("none"|"references"|"javascript") β Determines how email addresses are obfuscated in HTML.identifier-prefix(string) β Prefix to be added to all automatically-generated identifiers.title-prefix(string) β Prefix to be added to the title in the HTML header.reference-doc(file path) β Reference doc to use in creatingdocxorodtorpptx. Seepandoc(1)under--reference-docfor details. The contents of the file must be included underfiles.split-level(integer, default1) β Heading level at which documents are split in EPUB or chunked HTML.epub-cover-image(file path) β Cover image for EPUB. The contents of the file must be included underfiles.epub-metadata(file path) β Path of file containing Dublin core XML elements to be used for EPUB metadata. The contents of the file must be included underfiles.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 infiles(see below).ipynb-output("best"|"all"|"none") β okay so this one controls what happens to the output cells in an ipynb π«Άallmeans every single data format from the original gets preserved, no cap.nonemeans the contents of the data cells just get yeeted entirely. andbestmakes pandoc try to pick the richest data block in each output cell that's compatible with your output format β it's giving "choose the bestie that actually fits the vibe" β¨citeproc(boolean, defaultfalse) β sets off citation processing through citeproc π go read Citations inpandoc(1)for the deets, iykyk.bibliography(array of file paths) β the files holding your bibliographic data π lowkey important: the contents of those files have to be included infilestoo, or it's not gonna work.csl(file path) β your CSL style file π and again, the contents of that file must be included infiles. don't forget, bestie πcite-method("citeproc"|"natbib"|"biblatex") β decides how citations get formatted in LaTeX output π₯files(JSON mapping of file paths to base64-encoded strings) β this is where literally any file you need for the conversion goes, including images that are referred to in the document source πΌοΈ binary data must be base64-encoded. textual data can be left as it is, unless it's also valid base 64 data β in which case it will be interpreted that way π yeah, that's a little sneaky, be aware.
π¦ /batch endpoint π¦
so the /batch endpoint behaves like the root endpoint, except for these two points (and only these two, periodt):
- it accepts a JSON array, and each element of that array is a JSON object like the one the root endpoint expects π
- it returns a JSON array of JSON results π
this endpoint is perfect for converting a whole sequence of small snippets in one single request β it's giving efficiency, it's giving main character energy β
π§ /version endpoint π§
the /version endpoint accepts a GET request and returns the pandoc version as a plain or JSON-encoded string, depending on the Accept headers πΈ simple, iconic, does exactly what it says.
π /babelmark endpoint π
the /babelmark endpoint accepts a GET request with these query parameters π«Ά
text(required string)from(optional string, default is"markdown")to(optional string, default is"html")standalone(optional boolean, default isfalse)
it returns a JSON object with the fields html and version β¨ this endpoint exists specifically to support the Babelmark website β cute little cameo, honestly.
π AUTHORS π
Copyright 2022 John MacFarlane (jgm@berkeley.edu). Released under the GPL, version 2 or greater π this software carries no warranty of any kind π (see COPYRIGHT for the full copyright and warranty notices).
the Pandoc source code may be downloaded from <https://hackage.haskell.org/package/pandoc> or <https://github.com/jgm/pandoc/releases> π₯ and further documentation is available at <https://pandoc.org> π go treat yourself, bestie.
and that's the whole page, babes π this was pandoc 3.10, dated August 15, 2022, and the page is pandoc-server(1) β slay, you read the whole thing, so proud of you π«Άβ¨
π¦ where this page comes from
- alpine 3.24: pandoc-cli-doc 3.10-r0 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms