aboutsummaryrefslogtreecommitdiff
path: root/man/pandoc-server.1
blob: 20602d5c9a26f251eae7cc4caabf5932f0b42e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.\" 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.)