161 lines
4.9 KiB
Groff
161 lines
4.9 KiB
Groff
|
.\" Automatically generated by Pandoc 2.18
|
||
|
.\"
|
||
|
.\" Define V font for inline verbatim, using C font in formats
|
||
|
.\" that render this, and otherwise B font.
|
||
|
.ie "\f[CB]x\f[]"x" \{\
|
||
|
. ftr V B
|
||
|
. ftr VI BI
|
||
|
. ftr VB B
|
||
|
. ftr VBI BI
|
||
|
.\}
|
||
|
.el \{\
|
||
|
. ftr V CR
|
||
|
. ftr VI CI
|
||
|
. ftr VB CB
|
||
|
. ftr VBI CBI
|
||
|
.\}
|
||
|
.TH "pandoc-server" "1" "August 15, 2022" "pandoc-server 2.19" ""
|
||
|
.hy
|
||
|
.SH SYNOPSIS
|
||
|
.PP
|
||
|
\f[V]pandoc-server\f[R] [\f[I]options\f[R]]
|
||
|
.SH DESCRIPTION
|
||
|
.PP
|
||
|
\f[V]pandoc-server\f[R] 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 \f[V]pandoc-server\f[R] as a CGI program, rename it as
|
||
|
\f[V]pandoc-server.cgi\f[R].
|
||
|
.SH OPTIONS
|
||
|
.TP
|
||
|
\f[V]--port NUM\f[R]
|
||
|
HTTP port on which to run the server.
|
||
|
Default: 3030.
|
||
|
.TP
|
||
|
\f[V]--timeout SECONDS\f[R]
|
||
|
Timeout in seconds, after which a conversion is killed.
|
||
|
Default: 2.
|
||
|
.TP
|
||
|
\f[V]--help\f[R]
|
||
|
Help
|
||
|
.SH API
|
||
|
.SS Root endpoint
|
||
|
.PP
|
||
|
The root (\f[V]/\f[R]) endpoint accepts only POST requests.
|
||
|
It returns a converted document in one of the following formats,
|
||
|
depending on Accept headers:
|
||
|
.IP \[bu] 2
|
||
|
\f[V]text/plain\f[R]
|
||
|
.IP \[bu] 2
|
||
|
\f[V]application/json\f[R]
|
||
|
.IP \[bu] 2
|
||
|
\f[V]application/octet-stream\f[R]
|
||
|
.PP
|
||
|
If the result is a binary format (e.g., \f[V]epub\f[R] or
|
||
|
\f[V]docx\f[R]) and the content is returned as plain text or JSON, the
|
||
|
binary will be base64 encoded.
|
||
|
.PP
|
||
|
The body of the POST request should be a JSON object, with the following
|
||
|
fields.
|
||
|
Only the \f[V]text\f[R] field is required; all of the others can be
|
||
|
omitted for default values.
|
||
|
.TP
|
||
|
\f[V]text\f[R] (string)
|
||
|
the document to be converted.
|
||
|
Note: if the \f[V]from\f[R] format is binary (e.g., \f[V]epub\f[R] or
|
||
|
\f[V]docx\f[R]), then \f[V]text\f[R] should be a base64 encoding of the
|
||
|
document.
|
||
|
.TP
|
||
|
\f[V]from\f[R] (string, default \f[V]\[dq]markdown\[dq]\f[R])
|
||
|
the input format, possibly with extensions, just as it is specified on
|
||
|
the pandoc command line.
|
||
|
.TP
|
||
|
\f[V]to\f[R] (string, default \f[V]\[dq]html\[dq]\f[R])
|
||
|
the output format, possibly with extensions, just as it is specified on
|
||
|
the pandoc command line.
|
||
|
.IP
|
||
|
.nf
|
||
|
\f[C]
|
||
|
wrapText :: Maybe WrapOption
|
||
|
columns :: Maybe Int
|
||
|
standalone :: Maybe Bool
|
||
|
template :: Maybe Text
|
||
|
tabStop :: Maybe Int
|
||
|
indentedCodeClasses :: Maybe [Text]
|
||
|
abbreviations :: Maybe (Set Text)
|
||
|
defaultImageExtension :: Maybe Text
|
||
|
trackChanges :: Maybe TrackChanges
|
||
|
stripComments :: Maybe Bool
|
||
|
citeproc :: Maybe Bool
|
||
|
variables :: Maybe (DocTemplates.Context Text)
|
||
|
tableOfContents :: Maybe Bool
|
||
|
incremental :: Maybe Bool
|
||
|
htmlMathMethod :: Maybe HTMLMathMethod
|
||
|
numberSections :: Maybe Bool
|
||
|
numberOffset :: Maybe [Int]
|
||
|
sectionDivs :: Maybe Bool
|
||
|
referenceLinks :: Maybe Bool
|
||
|
dpi :: Maybe Int
|
||
|
emailObfuscation :: Maybe ObfuscationMethod
|
||
|
identifierPrefix :: Maybe Text
|
||
|
citeMethod :: Maybe CiteMethod
|
||
|
htmlQTags :: Maybe Bool
|
||
|
slideLevel :: Maybe Int
|
||
|
topLevelDivision :: Maybe TopLevelDivision
|
||
|
listings :: Maybe Bool
|
||
|
highlightStyle :: Maybe Text
|
||
|
setextHeaders :: Maybe Bool
|
||
|
epubSubdirectory :: Maybe Text
|
||
|
epubFonts :: Maybe [FilePath]
|
||
|
epubMetadata :: Maybe Text
|
||
|
epubChapterLevel :: Maybe Int
|
||
|
tocDepth :: Maybe Int
|
||
|
referenceDoc :: Maybe FilePath
|
||
|
referenceLocation :: Maybe ReferenceLocation
|
||
|
preferAscii :: Maybe Bool
|
||
|
files :: Maybe [(FilePath, Blob)]
|
||
|
\f[R]
|
||
|
.fi
|
||
|
.SS \f[V]/batch\f[R] endpoint
|
||
|
.PP
|
||
|
The \f[V]/batch\f[R] endpoint behaves like the root endpoint, except for
|
||
|
these two points:
|
||
|
.IP \[bu] 2
|
||
|
It accepts a JSON array, each element of which is a JSON object like the
|
||
|
one expected by the root endpoint.
|
||
|
.IP \[bu] 2
|
||
|
It returns a JSON array of results.
|
||
|
(It will not return plain text or octet-stream, like the root endpoint.)
|
||
|
.PP
|
||
|
This endpoint can be used to convert a sequence of small snippets in one
|
||
|
request.
|
||
|
.SS \f[V]/version\f[R] endpoint
|
||
|
.PP
|
||
|
The \f[V]/version\f[R] endpoint accepts a GET request and returns the
|
||
|
pandoc version as a plain or JSON-encoded string, depending on Accept
|
||
|
headers.
|
||
|
.SS \f[V]/babelmark\f[R] endpoint
|
||
|
.PP
|
||
|
The \f[V]/babelmark\f[R] endpoint accepts a GET request with the
|
||
|
following query parameters:
|
||
|
.IP \[bu] 2
|
||
|
\f[V]text\f[R] (required string)
|
||
|
.IP \[bu] 2
|
||
|
\f[V]from\f[R] (optional string, default is
|
||
|
\f[V]\[dq]markdown\[dq]\f[R])
|
||
|
.IP \[bu] 2
|
||
|
\f[V]to\f[R] (optional string, default is \f[V]\[dq]html\[dq]\f[R])
|
||
|
.IP \[bu] 2
|
||
|
\f[V]standalone\f[R] (optional boolean, default is \f[V]false\f[R])
|
||
|
.PP
|
||
|
It returns a JSON object with fields \f[V]html\f[R] and
|
||
|
\f[V]version\f[R].
|
||
|
This endpoint is designed to support the
|
||
|
Babelmarkhttps://babelmark.github.io website.
|
||
|
.SH AUTHORS
|
||
|
.PP
|
||
|
Copyright 2022 John MacFarlane (jgm\[at]berkeley.edu).
|
||
|
Released under the GPL, version 2 or greater.
|
||
|
This software carries no warranty of any kind.
|
||
|
(See COPYRIGHT for full copyright and warranty notices.)
|