-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
1951 lines (1855 loc) · 169 KB
/
index.html
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html >
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="template.css" />
<link href="https://vjs.zencdn.net/5.4.4/video-js.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type='text/javascript' src='menu/js/jquery.cookie.js'></script>
<script type='text/javascript' src='menu/js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='menu/js/jquery.dcjqaccordion.2.7.min.js'></script>
<link href="menu/css/skins/blue.css" rel="stylesheet" type="text/css" />
<link href="menu/css/skins/graphite.css" rel="stylesheet" type="text/css" />
<link href="menu/css/skins/grey.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="script.js"></script>
<script src="jquery.sticky-kit.js "></script>
<meta name="generator" content="pandoc" />
<meta name="author" content="John MacFarlane" />
<meta name="date" content="2016-01-12" />
<title>Pandoc User's Guide</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="template.css" type="text/css" />
</head>
<body>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container">
<span class="doc-title">Pandoc User's Guide</span>
<ul class="nav pull-right doc-info">
<li><p class="navbar-text">John MacFarlane</p></li>
<li><p class="navbar-text">January 12, 2016</p></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div id="TOC" class="span3">
<div class="well toc">
<ul>
<li><a href="#synopsis">Synopsis</a></li>
<li><a href="#description">Description</a><ul>
<li><a href="#using-pandoc">Using <code>pandoc</code></a></li>
<li><a href="#creating-a-pdf">Creating a PDF</a></li>
</ul></li>
<li><a href="#options">Options</a><ul>
<li><a href="#general-options">General options</a></li>
<li><a href="#reader-options">Reader options</a></li>
<li><a href="#general-writer-options">General writer options</a></li>
<li><a href="#options-affecting-specific-writers">Options affecting specific writers</a></li>
<li><a href="#citation-rendering">Citation rendering</a></li>
<li><a href="#math-rendering-in-html">Math rendering in HTML</a></li>
<li><a href="#options-for-wrapper-scripts">Options for wrapper scripts</a></li>
</ul></li>
<li><a href="#templates">Templates</a><ul>
<li><a href="#variables-set-by-pandoc">Variables set by pandoc</a></li>
<li><a href="#language-variables">Language variables</a></li>
<li><a href="#variables-for-slides">Variables for slides</a></li>
<li><a href="#variables-for-latex">Variables for LaTeX</a></li>
<li><a href="#variables-for-context">Variables for ConTeXt</a></li>
<li><a href="#variables-for-man-pages">Variables for man pages</a></li>
<li><a href="#using-variables-in-templates">Using variables in templates</a></li>
</ul></li>
<li><a href="#pandocs-markdown">Pandoc's Markdown</a><ul>
<li><a href="#philosophy">Philosophy</a></li>
<li><a href="#paragraphs">Paragraphs</a></li>
<li><a href="#headers">Headers</a></li>
<li><a href="#block-quotations">Block quotations</a></li>
<li><a href="#verbatim-code-blocks">Verbatim (code) blocks</a></li>
<li><a href="#line-blocks">Line blocks</a></li>
<li><a href="#lists">Lists</a></li>
<li><a href="#horizontal-rules">Horizontal rules</a></li>
<li><a href="#tables">Tables</a></li>
<li><a href="#metadata-blocks">Metadata blocks</a></li>
<li><a href="#backslash-escapes">Backslash escapes</a></li>
<li><a href="#smart-punctuation">Smart punctuation</a></li>
<li><a href="#inline-formatting">Inline formatting</a></li>
<li><a href="#math">Math</a></li>
<li><a href="#raw-html">Raw HTML</a></li>
<li><a href="#raw-tex">Raw TeX</a></li>
<li><a href="#latex-macros">LaTeX macros</a></li>
<li><a href="#links">Links</a></li>
<li><a href="#images">Images</a></li>
<li><a href="#footnotes">Footnotes</a></li>
<li><a href="#citations">Citations</a></li>
<li><a href="#non-pandoc-extensions">Non-pandoc extensions</a></li>
<li><a href="#markdown-variants">Markdown variants</a></li>
<li><a href="#extensions-with-formats-other-than-markdown">Extensions with formats other than Markdown</a></li>
</ul></li>
<li><a href="#producing-slide-shows-with-pandoc">Producing slide shows with pandoc</a><ul>
<li><a href="#structuring-the-slide-show">Structuring the slide show</a></li>
<li><a href="#incremental-lists">Incremental lists</a></li>
<li><a href="#inserting-pauses">Inserting pauses</a></li>
<li><a href="#styling-the-slides">Styling the slides</a></li>
<li><a href="#speaker-notes">Speaker notes</a></li>
<li><a href="#frame-attributes-in-beamer">Frame attributes in beamer</a></li>
</ul></li>
<li><a href="#creating-epubs-with-pandoc">Creating EPUBs with pandoc</a><ul>
<li><a href="#epub-metadata">EPUB Metadata</a></li>
<li><a href="#linked-media">Linked media</a></li>
</ul></li>
<li><a href="#literate-haskell-support">Literate Haskell support</a></li>
<li><a href="#syntax-highlighting">Syntax highlighting</a></li>
<li><a href="#custom-writers">Custom writers</a></li>
<li><a href="#authors">Authors</a></li>
</ul>
</div>
</div>
<div class="span9">
<h1 id="synopsis">Synopsis</h1>
<p><code>pandoc</code> [<em>options</em>] [<em>input-file</em>]...</p>
<h1 id="description">Description</h1>
<p>Pandoc is a <a href="https://www.haskell.org">Haskell</a> library for converting from one markup format to another, and a command-line tool that uses this library. It can read <a href="http://daringfireball.net/projects/markdown/">Markdown</a>, <a href="http://commonmark.org">CommonMark</a>, <a href="https://michelf.ca/projects/php-markdown/extra/">PHP Markdown Extra</a>, <a href="https://help.github.com/articles/github-flavored-markdown/">GitHub-Flavored Markdown</a>, and (subsets of) <a href="http://redcloth.org/textile">Textile</a>, <a href="http://docutils.sourceforge.net/docs/ref/rst/introduction.html">reStructuredText</a>, <a href="http://www.w3.org/html/">HTML</a>, <a href="http://latex-project.org">LaTeX</a>, <a href="https://www.mediawiki.org/wiki/Help:Formatting">MediaWiki markup</a>, <a href="http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules">TWiki markup</a>, <a href="https://www.haskell.org/haddock/doc/html/ch03s08.html">Haddock markup</a>, <a href="http://dev.opml.org/spec2.html">OPML</a>, <a href="http://orgmode.org">Emacs Org mode</a>, <a href="http://docbook.org">DocBook</a>, <a href="http://txt2tags.org">txt2tags</a>, <a href="http://idpf.org/epub">EPUB</a>, <a href="http://en.wikipedia.org/wiki/OpenDocument">ODT</a> and <a href="http://www.microsoft.com/interop/openup/openxml/default.aspx">Word docx</a>; and it can write plain text, <a href="http://daringfireball.net/projects/markdown/">Markdown</a>, <a href="http://commonmark.org">CommonMark</a>, <a href="https://michelf.ca/projects/php-markdown/extra/">PHP Markdown Extra</a>, <a href="https://help.github.com/articles/github-flavored-markdown/">GitHub-Flavored Markdown</a>, <a href="http://docutils.sourceforge.net/docs/ref/rst/introduction.html">reStructuredText</a>, <a href="http://www.w3.org/TR/xhtml1/">XHTML</a>, <a href="http://www.w3.org/TR/html5/">HTML5</a>, <a href="http://latex-project.org">LaTeX</a> (including <a href="https://ctan.org/pkg/beamer"><code>beamer</code></a> slide shows), <a href="http://contextgarden.net/">ConTeXt</a>, <a href="http://en.wikipedia.org/wiki/Rich_Text_Format">RTF</a>, <a href="http://dev.opml.org/spec2.html">OPML</a>, <a href="http://docbook.org">DocBook</a>, <a href="http://opendocument.xml.org">OpenDocument</a>, <a href="http://en.wikipedia.org/wiki/OpenDocument">ODT</a>, <a href="http://www.microsoft.com/interop/openup/openxml/default.aspx">Word docx</a>, <a href="http://www.gnu.org/software/texinfo/">GNU Texinfo</a>, <a href="https://www.mediawiki.org/wiki/Help:Formatting">MediaWiki markup</a>, <a href="https://www.dokuwiki.org/dokuwiki">DokuWiki markup</a>, <a href="https://www.haskell.org/haddock/doc/html/ch03s08.html">Haddock markup</a>, <a href="http://idpf.org/epub">EPUB</a> (v2 or v3), <a href="http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1">FictionBook2</a>, <a href="http://redcloth.org/textile">Textile</a>, <a href="http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html">groff man</a> pages, <a href="http://orgmode.org">Emacs Org mode</a>, <a href="http://www.methods.co.nz/asciidoc/">AsciiDoc</a>, <a href="https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf">InDesign ICML</a>, [TEI XML], and <a href="http://www.w3.org/Talks/Tools/Slidy/">Slidy</a>, <a href="http://goessner.net/articles/slideous/">Slideous</a>, <a href="http://paulrouget.com/dzslides/">DZSlides</a>, <a href="http://lab.hakim.se/reveal-js/">reveal.js</a> or <a href="http://meyerweb.com/eric/tools/s5/">S5</a> HTML slide shows. It can also produce <a href="https://www.adobe.com/pdf/">PDF</a> output on systems where LaTeX, ConTeXt, or <code>wkhtmltopdf</code> is installed.</p>
<p>Pandoc's enhanced version of Markdown includes syntax for <a href="#footnotes">footnotes</a>, <a href="#tables">tables</a>, flexible <a href="#ordered-lists">ordered lists</a>, <a href="#definition-lists">definition lists</a>, <a href="#fenced-code-blocks">fenced code blocks</a>, <a href="#superscripts-and-subscripts">superscripts and subscripts</a>, <a href="#strikeout">strikeout</a>, <a href="#metadata-blocks">metadata blocks</a>, automatic tables of contents, embedded LaTeX <a href="#math">math</a>, <a href="#citations">citations</a>, and <a href="#extension-markdown_in_html_blocks">Markdown inside HTML block elements</a>. (These enhancements, described below under <a href="#pandocs-markdown">Pandoc's Markdown</a>, can be disabled using the <code>markdown_strict</code> input or output format.)</p>
<p>In contrast to most existing tools for converting Markdown to HTML, which use regex substitutions, pandoc has a modular design: it consists of a set of readers, which parse text in a given format and produce a native representation of the document, and a set of writers, which convert this native representation into a target format. Thus, adding an input or output format requires only adding a reader or writer.</p>
<p>Because pandoc's intermediate representation of a document is less expressive than many of the formats it converts between, one should not expect perfect conversions between every format and every other. Pandoc attempts to preserve the structural elements of a document, but not formatting details such as margin size. And some document elements, such as complex tables, may not fit into pandoc's simple document model. While conversions from pandoc's Markdown to all formats aspire to be perfect, conversions from formats more expressive than pandoc's Markdown can be expected to be lossy.</p>
<h2 id="using-pandoc">Using <code>pandoc</code></h2>
<p>If no <em>input-file</em> is specified, input is read from <em>stdin</em>. Otherwise, the <em>input-files</em> are concatenated (with a blank line between each) and used as input. Output goes to <em>stdout</em> by default (though output to <em>stdout</em> is disabled for the <code>odt</code>, <code>docx</code>, <code>epub</code>, and <code>epub3</code> output formats). For output to a file, use the <code>-o</code> option:</p>
<pre><code>pandoc -o output.html input.txt</code></pre>
<p>By default, pandoc produces a document fragment, not a standalone document with a proper header and footer. To produce a standalone document, use the <code>-s</code> or <code>--standalone</code> flag:</p>
<pre><code>pandoc -s -o output.html input.txt</code></pre>
<p>For more information on how standalone documents are produced, see <a href="#templates">Templates</a>, below.</p>
<p>Instead of a file, an absolute URI may be given. In this case pandoc will fetch the content using HTTP:</p>
<pre><code>pandoc -f html -t markdown http://www.fsf.org</code></pre>
<p>If multiple input files are given, <code>pandoc</code> will concatenate them all (with blank lines between them) before parsing. This feature is disabled for binary input formats such as <code>EPUB</code>, <code>odt</code>, and <code>docx</code>.</p>
<p>The format of the input and output can be specified explicitly using command-line options. The input format can be specified using the <code>-r/--read</code> or <code>-f/--from</code> options, the output format using the <code>-w/--write</code> or <code>-t/--to</code> options. Thus, to convert <code>hello.txt</code> from Markdown to LaTeX, you could type:</p>
<pre><code>pandoc -f markdown -t latex hello.txt</code></pre>
<p>To convert <code>hello.html</code> from HTML to Markdown:</p>
<pre><code>pandoc -f html -t markdown hello.html</code></pre>
<p>Supported output formats are listed below under the <code>-t/--to</code> option. Supported input formats are listed below under the <code>-f/--from</code> option. Note that the <code>rst</code>, <code>textile</code>, <code>latex</code>, and <code>html</code> readers are not complete; there are some constructs that they do not parse.</p>
<p>If the input or output format is not specified explicitly, <code>pandoc</code> will attempt to guess it from the extensions of the input and output filenames. Thus, for example,</p>
<pre><code>pandoc -o hello.tex hello.txt</code></pre>
<p>will convert <code>hello.txt</code> from Markdown to LaTeX. If no output file is specified (so that output goes to <em>stdout</em>), or if the output file's extension is unknown, the output format will default to HTML. If no input file is specified (so that input comes from <em>stdin</em>), or if the input files' extensions are unknown, the input format will be assumed to be Markdown unless explicitly specified.</p>
<p>Pandoc uses the UTF-8 character encoding for both input and output. If your local character encoding is not UTF-8, you should pipe input and output through <a href="http://www.gnu.org/software/libiconv/"><code>iconv</code></a>:</p>
<pre><code>iconv -t utf-8 input.txt | pandoc | iconv -f utf-8</code></pre>
<p>Note that in some output formats (such as HTML, LaTeX, ConTeXt, RTF, OPML, DocBook, and Texinfo), information about the character encoding is included in the document header, which will only be included if you use the <code>-s/--standalone</code> option.</p>
<h2 id="creating-a-pdf">Creating a PDF</h2>
<p>To produce a PDF, specify an output file with a <code>.pdf</code> extension. By default, pandoc will use LaTeX to convert it to PDF:</p>
<pre><code>pandoc test.txt -o test.pdf</code></pre>
<p>Production of a PDF requires that a LaTeX engine be installed (see <code>--latex-engine</code>, below), and assumes that the following LaTeX packages are available: <a href="https://ctan.org/pkg/amsfonts"><code>amsfonts</code></a>, <a href="https://ctan.org/pkg/amsmath"><code>amsmath</code></a>, <a href="https://ctan.org/pkg/lm"><code>lm</code></a>, <a href="https://ctan.org/pkg/ifxetex"><code>ifxetex</code></a>, <a href="https://ctan.org/pkg/ifluatex"><code>ifluatex</code></a>, <a href="https://ctan.org/pkg/eurosym"><code>eurosym</code></a>, <a href="https://ctan.org/pkg/listings"><code>listings</code></a> (if the <code>--listings</code> option is used), <a href="https://ctan.org/pkg/fancyvrb"><code>fancyvrb</code></a>, <a href="https://ctan.org/pkg/longtable"><code>longtable</code></a>, <a href="https://ctan.org/pkg/booktabs"><code>booktabs</code></a>, <a href="https://ctan.org/pkg/graphicx"><code>graphicx</code></a> and <a href="https://ctan.org/pkg/grffile"><code>grffile</code></a> (if the document contains images), <a href="https://ctan.org/pkg/hyperref"><code>hyperref</code></a>, <a href="https://ctan.org/pkg/ulem"><code>ulem</code></a>, <a href="https://ctan.org/pkg/geometry"><code>geometry</code></a> (with the <code>geometry</code> variable set), <a href="https://ctan.org/pkg/setspace"><code>setspace</code></a> (with <code>linestretch</code>), and <a href="https://ctan.org/pkg/babel"><code>babel</code></a> (with <code>lang</code>). The use of <code>xelatex</code> or <code>lualatex</code> as the LaTeX engine requires <a href="https://ctan.org/pkg/fontspec"><code>fontspec</code></a>; <code>xelatex</code> uses <a href="https://ctan.org/pkg/mathspec"><code>mathspec</code></a>, <a href="https://ctan.org/pkg/polyglossia"><code>polyglossia</code></a> (with <code>lang</code>), <a href="https://ctan.org/pkg/xecjk"><code>xecjk</code></a>, and <a href="https://ctan.org/pkg/bidi"><code>bidi</code></a> (with the <code>dir</code> variable set). The <a href="https://ctan.org/pkg/upquote"><code>upquote</code></a> and <a href="https://ctan.org/pkg/microtype"><code>microtype</code></a> packages are used if available, and <a href="https://ctan.org/pkg/csquotes"><code>csquotes</code></a> will be used for <a href="#smart-punctuation">smart punctuation</a> if added to the template or included in any header file. The <a href="https://ctan.org/pkg/natbib"><code>natbib</code></a>, <a href="https://ctan.org/pkg/biblatex"><code>biblatex</code></a>, <a href="https://ctan.org/pkg/bibtex"><code>bibtex</code></a>, and <a href="https://ctan.org/pkg/biber"><code>biber</code></a> packages can optionally be used for <a href="#citation-rendering">citation rendering</a>. These are included with all recent versions of <a href="http://www.tug.org/texlive/">TeX Live</a>.</p>
<p>Alternatively, pandoc can use ConTeXt or <code>wkhtmltopdf</code> to create a PDF. To do this, specify an output file with a <code>.pdf</code> extension, as before, but add <code>-t context</code> or <code>-t html5</code> to the command line.</p>
<p>PDF output can be controlled using <a href="#variables-for-latex">variables for LaTeX</a> (if LaTeX is used) and <a href="#variables-for-context">variables for ConTeXt</a> (if ConTeXt is used). If <code>wkhtmltopdf</code> is used, then the variables <code>margin-left</code>, <code>margin-right</code>, <code>margin-top</code>, <code>margin-bottom</code>, and <code>papersize</code> will affect the output, as will <code>--css</code>.</p>
<h1 id="options">Options</h1>
<h2 id="general-options">General options</h2>
<dl>
<dt><code>-f</code> <em>FORMAT</em>, <code>-r</code> <em>FORMAT</em>, <code>--from=</code><em>FORMAT</em>, <code>--read=</code><em>FORMAT</em></dt>
<dd><p>Specify input format. <em>FORMAT</em> can be <code>native</code> (native Haskell), <code>json</code> (JSON version of native AST), <code>markdown</code> (pandoc's extended Markdown), <code>markdown_strict</code> (original unextended Markdown), <code>markdown_phpextra</code> (PHP Markdown Extra), <code>markdown_github</code> (GitHub-Flavored Markdown), <code>commonmark</code> (CommonMark Markdown), <code>textile</code> (Textile), <code>rst</code> (reStructuredText), <code>html</code> (HTML), <code>docbook</code> (DocBook), <code>t2t</code> (txt2tags), <code>docx</code> (docx), <code>odt</code> (ODT), <code>epub</code> (EPUB), <code>opml</code> (OPML), <code>org</code> (Emacs Org mode), <code>mediawiki</code> (MediaWiki markup), <code>twiki</code> (TWiki markup), <code>haddock</code> (Haddock markup), or <code>latex</code> (LaTeX). If <code>+lhs</code> is appended to <code>markdown</code>, <code>rst</code>, <code>latex</code>, or <code>html</code>, the input will be treated as literate Haskell source: see <a href="#literate-haskell-support">Literate Haskell support</a>, below. Markdown syntax extensions can be individually enabled or disabled by appending <code>+EXTENSION</code> or <code>-EXTENSION</code> to the format name. So, for example, <code>markdown_strict+footnotes+definition_lists</code> is strict Markdown with footnotes and definition lists enabled, and <code>markdown-pipe_tables+hard_line_breaks</code> is pandoc's Markdown without pipe tables and with hard line breaks. See <a href="#pandocs-markdown">Pandoc's Markdown</a>, below, for a list of extensions and their names.</p>
</dd>
<dt><code>-t</code> <em>FORMAT</em>, <code>-w</code> <em>FORMAT</em>, <code>--to=</code><em>FORMAT</em>, <code>--write=</code><em>FORMAT</em></dt>
<dd><p>Specify output format. <em>FORMAT</em> can be <code>native</code> (native Haskell), <code>json</code> (JSON version of native AST), <code>plain</code> (plain text), <code>markdown</code> (pandoc's extended Markdown), <code>markdown_strict</code> (original unextended Markdown), <code>markdown_phpextra</code> (PHP Markdown Extra), <code>markdown_github</code> (GitHub-Flavored Markdown), <code>commonmark</code> (CommonMark Markdown), <code>rst</code> (reStructuredText), <code>html</code> (XHTML), <code>html5</code> (HTML5), <code>latex</code> (LaTeX), <code>beamer</code> (LaTeX beamer slide show), <code>context</code> (ConTeXt), <code>man</code> (groff man), <code>mediawiki</code> (MediaWiki markup), <code>dokuwiki</code> (DokuWiki markup), <code>textile</code> (Textile), <code>org</code> (Emacs Org mode), <code>texinfo</code> (GNU Texinfo), <code>opml</code> (OPML), <code>docbook</code> (DocBook), <code>opendocument</code> (OpenDocument), <code>odt</code> (OpenOffice text document), <code>docx</code> (Word docx), <code>haddock</code> (Haddock markup), <code>rtf</code> (rich text format), <code>epub</code> (EPUB v2 book), <code>epub3</code> (EPUB v3), <code>fb2</code> (FictionBook2 e-book), <code>asciidoc</code> (AsciiDoc), <code>icml</code> (InDesign ICML), <code>tei</code> (TEI Simple), <code>slidy</code> (Slidy HTML and javascript slide show), <code>slideous</code> (Slideous HTML and javascript slide show), <code>dzslides</code> (DZSlides HTML5 + javascript slide show), <code>revealjs</code> (reveal.js HTML5 + javascript slide show), <code>s5</code> (S5 HTML and javascript slide show), or the path of a custom lua writer (see <a href="#custom-writers">Custom writers</a>, below). Note that <code>odt</code>, <code>epub</code>, and <code>epub3</code> output will not be directed to <em>stdout</em>; an output filename must be specified using the <code>-o/--output</code> option. If <code>+lhs</code> is appended to <code>markdown</code>, <code>rst</code>, <code>latex</code>, <code>beamer</code>, <code>html</code>, or <code>html5</code>, the output will be rendered as literate Haskell source: see <a href="#literate-haskell-support">Literate Haskell support</a>, below. Markdown syntax extensions can be individually enabled or disabled by appending <code>+EXTENSION</code> or <code>-EXTENSION</code> to the format name, as described above under <code>-f</code>.</p>
</dd>
<dt><code>-o</code> <em>FILE</em>, <code>--output=</code><em>FILE</em></dt>
<dd><p>Write output to <em>FILE</em> instead of <em>stdout</em>. If <em>FILE</em> is <code>-</code>, output will go to <em>stdout</em>. (Exception: if the output format is <code>odt</code>, <code>docx</code>, <code>epub</code>, or <code>epub3</code>, output to stdout is disabled.)</p>
</dd>
<dt><code>--data-dir=</code><em>DIRECTORY</em></dt>
<dd><p>Specify the user data directory to search for pandoc data files. If this option is not specified, the default user data directory will be used. This is, in Unix:</p>
<pre><code>$HOME/.pandoc</code></pre>
<p>in Windows XP:</p>
<pre><code>C:\Documents And Settings\USERNAME\Application Data\pandoc</code></pre>
<p>and in Windows Vista or later:</p>
<pre><code>C:\Users\USERNAME\AppData\Roaming\pandoc</code></pre>
<p>You can find the default user data directory on your system by looking at the output of <code>pandoc --version</code>. A <code>reference.odt</code>, <code>reference.docx</code>, <code>epub.css</code>, <code>templates</code>, <code>slidy</code>, <code>slideous</code>, or <code>s5</code> directory placed in this directory will override pandoc's normal defaults.</p>
</dd>
<dt><code>--bash-completion</code></dt>
<dd><p>Generate a bash completion script. To enable bash completion with pandoc, add this to your <code>.bashrc</code>:</p>
<pre><code> eval "$(pandoc --bash-completion)"</code></pre>
</dd>
<dt><code>--verbose</code></dt>
<dd><p>Give verbose debugging output. Currently this only has an effect with PDF output.</p>
</dd>
<dt><code>-v</code>, <code>--version</code></dt>
<dd><p>Print version.</p>
</dd>
<dt><code>-h</code>, <code>--help</code></dt>
<dd><p>Show usage message.</p>
</dd>
</dl>
<h2 id="reader-options">Reader options</h2>
<dl>
<dt><code>-R</code>, <code>--parse-raw</code></dt>
<dd><p>Parse untranslatable HTML codes and LaTeX environments as raw HTML or LaTeX, instead of ignoring them. Affects only HTML and LaTeX input. Raw HTML can be printed in Markdown, reStructuredText, HTML, Slidy, Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX can be printed in Markdown, reStructuredText, LaTeX, and ConTeXt output. The default is for the readers to omit untranslatable HTML codes and LaTeX environments. (The LaTeX reader does pass through untranslatable LaTeX <em>commands</em>, even if <code>-R</code> is not specified.)</p>
</dd>
<dt><code>-S</code>, <code>--smart</code></dt>
<dd><p>Produce typographically correct output, converting straight quotes to curly quotes, <code>---</code> to em-dashes, <code>--</code> to en-dashes, and <code>...</code> to ellipses. Nonbreaking spaces are inserted after certain abbreviations, such as "Mr." (Note: This option is selected automatically when the output format is <code>latex</code> or <code>context</code>, unless <code>--no-tex-ligatures</code> is used. It has no effect for <code>latex</code> input.)</p>
</dd>
<dt><code>--old-dashes</code></dt>
<dd><p>Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: <code>-</code> before a numeral is an en-dash, and <code>--</code> is an em-dash. This option is selected automatically for <code>textile</code> input.</p>
</dd>
<dt><code>--base-header-level=</code><em>NUMBER</em></dt>
<dd><p>Specify the base level for headers (defaults to 1).</p>
</dd>
<dt><code>--indented-code-classes=</code><em>CLASSES</em></dt>
<dd><p>Specify classes to use for indented code blocks--for example, <code>perl,numberLines</code> or <code>haskell</code>. Multiple classes may be separated by spaces or commas.</p>
</dd>
<dt><code>--default-image-extension=</code><em>EXTENSION</em></dt>
<dd><p>Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the Markdown and LaTeX readers.</p>
</dd>
<dt><code>--filter=</code><em>EXECUTABLE</em></dt>
<dd><p>Specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written. The executable should read JSON from stdin and write JSON to stdout. The JSON must be formatted like pandoc's own JSON input and output. The name of the output format will be passed to the filter as the first argument. Hence,</p>
<pre><code>pandoc --filter ./caps.py -t latex</code></pre>
<p>is equivalent to</p>
<pre><code>pandoc -t json | ./caps.py latex | pandoc -f json -t latex</code></pre>
<p>The latter form may be useful for debugging filters.</p>
<p>Filters may be written in any language. <code>Text.Pandoc.JSON</code> exports <code>toJSONFilter</code> to facilitate writing filters in Haskell. Those who would prefer to write filters in python can use the module <a href="https://github.com/jgm/pandocfilters"><code>pandocfilters</code></a>, installable from PyPI. There are also pandoc filter libraries in <a href="https://github.com/vinai/pandocfilters-php">PHP</a>, <a href="https://metacpan.org/pod/Pandoc::Filter">perl</a>, and <a href="https://github.com/mvhenderson/pandoc-filter-node">javascript/node.js</a>.</p>
<p>Note that the <em>EXECUTABLE</em> will be sought in the user's <code>PATH</code>, and not in the working directory, if no directory is provided. If you want to run a script in the working directory, preface the filename with <code>./</code>.</p>
</dd>
<dt><code>-M</code> <em>KEY</em>[<code>=</code><em>VAL</em>], <code>--metadata=</code><em>KEY</em>[<code>:</code><em>VAL</em>]</dt>
<dd><p>Set the metadata field <em>KEY</em> to the value <em>VAL</em>. A value specified on the command line overrides a value specified in the document. Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true. Like <code>--variable</code>, <code>--metadata</code> causes template variables to be set. But unlike <code>--variable</code>, <code>--metadata</code> affects the metadata of the underlying document (which is accessible from filters and may be printed in some output formats).</p>
</dd>
<dt><code>--normalize</code></dt>
<dd><p>Normalize the document after reading: merge adjacent <code>Str</code> or <code>Emph</code> elements, for example, and remove repeated <code>Space</code>s.</p>
</dd>
<dt><code>-p</code>, <code>--preserve-tabs</code></dt>
<dd><p>Preserve tabs instead of converting them to spaces (the default). Note that this will only affect tabs in literal code spans and code blocks; tabs in regular text will be treated as spaces.</p>
</dd>
<dt><code>--tab-stop=</code><em>NUMBER</em></dt>
<dd><p>Specify the number of spaces per tab (default is 4).</p>
</dd>
<dt><code>--track-changes=accept</code>|<code>reject</code>|<code>all</code></dt>
<dd><p>Specifies what to do with insertions and deletions produced by the MS Word "Track Changes" feature. <code>accept</code> (the default), inserts all insertions, and ignores all deletions. <code>reject</code> inserts all deletions and ignores insertions. <code>all</code> puts in both insertions and deletions, wrapped in spans with <code>insertion</code> and <code>deletion</code> classes, respectively. The author and time of change is included. <code>all</code> is useful for scripting: only accepting changes from a certain reviewer, say, or before a certain date. This option only affects the docx reader.</p>
</dd>
<dt><code>--extract-media=</code><em>DIR</em></dt>
<dd><p>Extract images and other media contained in a docx or epub container to the path <em>DIR</em>, creating it if necessary, and adjust the images references in the document so they point to the extracted files. This option only affects the docx and epub readers.</p>
</dd>
</dl>
<h2 id="general-writer-options">General writer options</h2>
<dl>
<dt><code>-s</code>, <code>--standalone</code></dt>
<dd><p>Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option is set automatically for <code>pdf</code>, <code>epub</code>, <code>epub3</code>, <code>fb2</code>, <code>docx</code>, and <code>odt</code> output.</p>
</dd>
<dt><code>--template=</code><em>FILE</em></dt>
<dd><p>Use <em>FILE</em> as a custom template for the generated document. Implies <code>--standalone</code>. See <a href="#templates">Templates</a>, below, for a description of template syntax. If no extension is specified, an extension corresponding to the writer will be added, so that <code>--template=special</code> looks for <code>special.html</code> for HTML output. If the template is not found, pandoc will search for it in the <code>templates</code> subdirectory of the user data directory (see <code>--data-dir</code>). If this option is not used, a default template appropriate for the output format will be used (see <code>-D/--print-default-template</code>).</p>
</dd>
<dt><code>-V</code> <em>KEY</em>[<code>=</code><em>VAL</em>], <code>--variable=</code><em>KEY</em>[<code>:</code><em>VAL</em>]</dt>
<dd><p>Set the template variable <em>KEY</em> to the value <em>VAL</em> when rendering the document in standalone mode. This is generally only useful when the <code>--template</code> option is used to specify a custom template, since pandoc automatically sets the variables used in the default templates. If no <em>VAL</em> is specified, the key will be given the value <code>true</code>.</p>
</dd>
<dt><code>-D</code> <em>FORMAT</em>, <code>--print-default-template=</code><em>FORMAT</em></dt>
<dd><p>Print the system default template for an output <em>FORMAT</em>. (See <code>-t</code> for a list of possible <em>FORMAT</em>s.) Templates in the user data directory are ignored.</p>
</dd>
<dt><code>--print-default-data-file=</code><em>FILE</em></dt>
<dd><p>Print a system default data file. Files in the user data directory are ignored.</p>
</dd>
<dt><code>--dpi</code>=<em>NUMBER</em></dt>
<dd>Specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa. The default is 96dpi. Technically, the correct term would be ppi (pixels per inch).
</dd>
<dt><code>--wrap=[auto|none|preserve]</code></dt>
<dd><p>Determine how text is wrapped in the output (the source code, not the rendered version). With <code>auto</code> (the default), pandoc will attempt to wrap lines to the column width specified by <code>--columns</code> (default 80). With <code>none</code>, pandoc will not wrap lines at all. With <code>preserve</code>, pandoc will attempt to preserve the wrapping from the source document (that is, where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well).</p>
</dd>
<dt><code>--no-wrap</code></dt>
<dd><p>Deprecated synonym for <code>--wrap=none</code>.</p>
</dd>
<dt><code>--columns=</code><em>NUMBER</em></dt>
<dd><p>Specify length of lines in characters (for text wrapping). This affects only the generated source code, not the layout on the rendered page.</p>
</dd>
<dt><code>--toc</code>, <code>--table-of-contents</code></dt>
<dd><p>Include an automatically generated table of contents (or, in the case of <code>latex</code>, <code>context</code>, and <code>rst</code>, an instruction to create one) in the output document. This option has no effect on <code>man</code>, <code>docbook</code>, <code>slidy</code>, <code>slideous</code>, <code>s5</code>, <code>docx</code>, or <code>odt</code> output.</p>
</dd>
<dt><code>--toc-depth=</code><em>NUMBER</em></dt>
<dd><p>Specify the number of section levels to include in the table of contents. The default is 3 (which means that level 1, 2, and 3 headers will be listed in the contents).</p>
</dd>
<dt><code>--no-highlight</code></dt>
<dd><p>Disables syntax highlighting for code blocks and inlines, even when a language attribute is given.</p>
</dd>
<dt><code>--highlight-style=</code><em>STYLE</em></dt>
<dd><p>Specifies the coloring style to be used in highlighted source code. Options are <code>pygments</code> (the default), <code>kate</code>, <code>monochrome</code>, <code>espresso</code>, <code>zenburn</code>, <code>haddock</code>, and <code>tango</code>. For more information on syntax highlighting in pandoc, see <a href="#syntax-highlighting">Syntax highlighting</a>, below.</p>
</dd>
<dt><code>-H</code> <em>FILE</em>, <code>--include-in-header=</code><em>FILE</em></dt>
<dd><p>Include contents of <em>FILE</em>, verbatim, at the end of the header. This can be used, for example, to include special CSS or javascript in HTML documents. This option can be used repeatedly to include multiple files in the header. They will be included in the order specified. Implies <code>--standalone</code>.</p>
</dd>
<dt><code>-B</code> <em>FILE</em>, <code>--include-before-body=</code><em>FILE</em></dt>
<dd><p>Include contents of <em>FILE</em>, verbatim, at the beginning of the document body (e.g. after the <code><body></code> tag in HTML, or the <code>\begin{document}</code> command in LaTeX). This can be used to include navigation bars or banners in HTML documents. This option can be used repeatedly to include multiple files. They will be included in the order specified. Implies <code>--standalone</code>.</p>
</dd>
<dt><code>-A</code> <em>FILE</em>, <code>--include-after-body=</code><em>FILE</em></dt>
<dd><p>Include contents of <em>FILE</em>, verbatim, at the end of the document body (before the <code></body></code> tag in HTML, or the <code>\end{document}</code> command in LaTeX). This option can be used repeatedly to include multiple files. They will be included in the order specified. Implies <code>--standalone</code>.</p>
</dd>
</dl>
<h2 id="options-affecting-specific-writers">Options affecting specific writers</h2>
<dl>
<dt><code>--self-contained</code></dt>
<dd><p>Produce a standalone HTML file with no external dependencies, using <code>data:</code> URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. The resulting file should be "self-contained," in the sense that it needs no external files and no net access to be displayed properly by a browser. This option works only with HTML output formats, including <code>html</code>, <code>html5</code>, <code>html+lhs</code>, <code>html5+lhs</code>, <code>s5</code>, <code>slidy</code>, <code>slideous</code>, <code>dzslides</code>, and <code>revealjs</code>. Scripts, images, and stylesheets at absolute URLs will be downloaded; those at relative URLs will be sought relative to the working directory (if the first source file is local) or relative to the base URL (if the first source file is remote). Limitation: resources that are loaded dynamically through JavaScript cannot be incorporated; as a result, <code>--self-contained</code> does not work with <code>--mathjax</code>, and some advanced features (e.g. zoom or speaker notes) may not work in an offline "self-contained" <code>reveal.js</code> slide show.</p>
</dd>
<dt><code>--html-q-tags</code></dt>
<dd><p>Use <code><q></code> tags for quotes in HTML.</p>
</dd>
<dt><code>--ascii</code></dt>
<dd><p>Use only ascii characters in output. Currently supported only for HTML output (which uses numerical entities instead of UTF-8 when this option is selected).</p>
</dd>
<dt><code>--reference-links</code></dt>
<dd><p>Use reference-style links, rather than inline links, in writing Markdown or reStructuredText. By default inline links are used.</p>
</dd>
<dt><code>--atx-headers</code></dt>
<dd><p>Use ATX-style headers in Markdown and asciidoc output. The default is to use setext-style headers for levels 1-2, and then ATX headers.</p>
</dd>
<dt><code>--chapters</code></dt>
<dd><p>Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook output. When the LaTeX document class is set to <code>report</code>, <code>book</code>, or <code>memoir</code> (unless the <code>article</code> option is specified), this option is implied. If <code>beamer</code> is the output format, top-level headers will become <code>\part{..}</code>.</p>
</dd>
<dt><code>-N</code>, <code>--number-sections</code></dt>
<dd><p>Number section headings in LaTeX, ConTeXt, HTML, or EPUB output. By default, sections are not numbered. Sections with class <code>unnumbered</code> will never be numbered, even if <code>--number-sections</code> is specified.</p>
</dd>
<dt><code>--number-offset=</code><em>NUMBER</em>[<code>,</code><em>NUMBER</em><code>,</code><em>...</em>]</dt>
<dd><p>Offset for section headings in HTML output (ignored in other output formats). The first number is added to the section number for top-level headers, the second for second-level headers, and so on. So, for example, if you want the first top-level header in your document to be numbered "6", specify <code>--number-offset=5</code>. If your document starts with a level-2 header which you want to be numbered "1.5", specify <code>--number-offset=1,4</code>. Offsets are 0 by default. Implies <code>--number-sections</code>.</p>
</dd>
<dt><code>--no-tex-ligatures</code></dt>
<dd><p>Do not use the TeX ligatures for quotation marks, apostrophes, and dashes (<code>`...'</code>, <code>``..''</code>, <code>--</code>, <code>---</code>) when writing or reading LaTeX or ConTeXt. In reading LaTeX, parse the characters <code>`</code>, <code>'</code>, and <code>-</code> literally, rather than parsing ligatures for quotation marks and dashes. In writing LaTeX or ConTeXt, print unicode quotation mark and dash characters literally, rather than converting them to the standard ASCII TeX ligatures. Note: normally <code>--smart</code> is selected automatically for LaTeX and ConTeXt output, but it must be specified explicitly if <code>--no-tex-ligatures</code> is selected. If you use literal curly quotes, dashes, and ellipses in your source, then you may want to use <code>--no-tex-ligatures</code> without <code>--smart</code>.</p>
</dd>
<dt><code>--listings</code></dt>
<dd><p>Use the <a href="https://ctan.org/pkg/listings"><code>listings</code></a> package for LaTeX code blocks</p>
</dd>
<dt><code>-i</code>, <code>--incremental</code></dt>
<dd><p>Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once.</p>
</dd>
<dt><code>--slide-level=</code><em>NUMBER</em></dt>
<dd><p>Specifies that headers with the specified level create slides (for <code>beamer</code>, <code>s5</code>, <code>slidy</code>, <code>slideous</code>, <code>dzslides</code>). Headers above this level in the hierarchy are used to divide the slide show into sections; headers below this level create subheads within a slide. The default is to set the slide level based on the contents of the document; see <a href="#structuring-the-slide-show">Structuring the slide show</a>.</p>
</dd>
<dt><code>--section-divs</code></dt>
<dd><p>Wrap sections in <code><div></code> tags (or <code><section></code> tags in HTML5), and attach identifiers to the enclosing <code><div></code> (or <code><section></code>) rather than the header itself. See <a href="#header-identifiers">Header identifiers</a>, below.</p>
</dd>
<dt><code>--email-obfuscation=none</code>|<code>javascript</code>|<code>references</code></dt>
<dd><p>Specify a method for obfuscating <code>mailto:</code> links in HTML documents. <code>none</code> leaves <code>mailto:</code> links as they are. <code>javascript</code> obfuscates them using javascript. <code>references</code> obfuscates them by printing their letters as decimal or hexadecimal character references. The default is <code>javascript</code>.</p>
</dd>
<dt><code>--id-prefix=</code><em>STRING</em></dt>
<dd><p>Specify a prefix to be added to all automatically generated identifiers in HTML and DocBook output, and to footnote numbers in Markdown output. This is useful for preventing duplicate identifiers when generating fragments to be included in other pages.</p>
</dd>
<dt><code>-T</code> <em>STRING</em>, <code>--title-prefix=</code><em>STRING</em></dt>
<dd><p>Specify <em>STRING</em> as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). Implies <code>--standalone</code>.</p>
</dd>
<dt><code>-c</code> <em>URL</em>, <code>--css=</code><em>URL</em></dt>
<dd><p>Link to a CSS style sheet. This option can be used repeatedly to include multiple files. They will be included in the order specified.</p>
</dd>
<dt><code>--reference-odt=</code><em>FILE</em></dt>
<dd><p>Use the specified file as a style reference in producing an ODT. For best results, the reference ODT should be a modified version of an ODT produced using pandoc. The contents of the reference ODT are ignored, but its stylesheets are used in the new ODT. If no reference ODT is specified on the command line, pandoc will look for a file <code>reference.odt</code> in the user data directory (see <code>--data-dir</code>). If this is not found either, sensible defaults will be used.</p>
</dd>
<dt><code>--reference-docx=</code><em>FILE</em></dt>
<dd><p>Use the specified file as a style reference in producing a docx file. For best results, the reference docx should be a modified version of a docx file produced using pandoc. The contents of the reference docx are ignored, but its stylesheets and document properties (including margins, page size, header, and footer) are used in the new docx. If no reference docx is specified on the command line, pandoc will look for a file <code>reference.docx</code> in the user data directory (see <code>--data-dir</code>). If this is not found either, sensible defaults will be used. The following styles are used by pandoc: [paragraph] Normal, Body Text, First Paragraph, Compact, Title, Subtitle, Author, Date, Abstract, Bibliography, Heading 1, Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Block Text, Footnote Text, Definition Term, Definition, Caption, Table Caption, Image Caption, Figure, Figure With Caption, TOC Heading; [character] Default Paragraph Font, Body Text Char, Verbatim Char, Footnote Reference, Hyperlink; [table] Normal Table.</p>
</dd>
<dt><code>--epub-stylesheet=</code><em>FILE</em></dt>
<dd><p>Use the specified CSS file to style the EPUB. If no stylesheet is specified, pandoc will look for a file <code>epub.css</code> in the user data directory (see <code>--data-dir</code>). If it is not found there, sensible defaults will be used.</p>
</dd>
<dt><code>--epub-cover-image=</code><em>FILE</em></dt>
<dd><p>Use the specified image as the EPUB cover. It is recommended that the image be less than 1000px in width and height. Note that in a Markdown source document you can also specify <code>cover-image</code> in a YAML metadata block (see <a href="#epub-metadata">EPUB Metadata</a>, below).</p>
</dd>
<dt><code>--epub-metadata=</code><em>FILE</em></dt>
<dd><p>Look in the specified XML file for metadata for the EPUB. The file should contain a series of <a href="http://dublincore.org/documents/dces/">Dublin Core elements</a>. For example:</p>
<pre><code> <dc:rights>Creative Commons</dc:rights>
<dc:language>es-AR</dc:language></code></pre>
<p>By default, pandoc will include the following metadata elements: <code><dc:title></code> (from the document title), <code><dc:creator></code> (from the document authors), <code><dc:date></code> (from the document date, which should be in <a href="http://www.w3.org/TR/NOTE-datetime">ISO 8601 format</a>), <code><dc:language></code> (from the <code>lang</code> variable, or, if is not set, the locale), and <code><dc:identifier id="BookId"></code> (a randomly generated UUID). Any of these may be overridden by elements in the metadata file.</p>
<p>Note: if the source document is Markdown, a YAML metadata block in the document can be used instead. See below under <a href="#epub-metadata">EPUB Metadata</a>.</p>
</dd>
<dt><code>--epub-embed-font=</code><em>FILE</em></dt>
<dd><p>Embed the specified font in the EPUB. This option can be repeated to embed multiple fonts. Wildcards can also be used: for example, <code>DejaVuSans-*.ttf</code>. However, if you use wildcards on the command line, be sure to escape them or put the whole filename in single quotes, to prevent them from being interpreted by the shell. To use the embedded fonts, you will need to add declarations like the following to your CSS (see <code>--epub-stylesheet</code>):</p>
<pre><code>@font-face {
font-family: DejaVuSans;
font-style: normal;
font-weight: normal;
src:url("DejaVuSans-Regular.ttf");
}
@font-face {
font-family: DejaVuSans;
font-style: normal;
font-weight: bold;
src:url("DejaVuSans-Bold.ttf");
}
@font-face {
font-family: DejaVuSans;
font-style: italic;
font-weight: normal;
src:url("DejaVuSans-Oblique.ttf");
}
@font-face {
font-family: DejaVuSans;
font-style: italic;
font-weight: bold;
src:url("DejaVuSans-BoldOblique.ttf");
}
body { font-family: "DejaVuSans"; }</code></pre>
</dd>
<dt><code>--epub-chapter-level=</code><em>NUMBER</em></dt>
<dd><p>Specify the header level at which to split the EPUB into separate "chapter" files. The default is to split into chapters at level 1 headers. This option only affects the internal composition of the EPUB, not the way chapters and sections are displayed to users. Some readers may be slow if the chapter files are too large, so for large documents with few level 1 headers, one might want to use a chapter level of 2 or 3.</p>
</dd>
<dt><code>--latex-engine=pdflatex</code>|<code>lualatex</code>|<code>xelatex</code></dt>
<dd><p>Use the specified LaTeX engine when producing PDF output. The default is <code>pdflatex</code>. If the engine is not in your PATH, the full path of the engine may be specified here.</p>
</dd>
<dt><code>--latex-engine-opt=</code><em>STRING</em></dt>
<dd><p>Use the given string as a command-line argument to the <code>latex-engine</code>. If used multiple times, the arguments are provided with spaces between them. Note that no check for duplicate options is done.</p>
</dd>
</dl>
<h2 id="citation-rendering">Citation rendering</h2>
<dl>
<dt><code>--bibliography=</code><em>FILE</em></dt>
<dd><p>Set the <code>bibliography</code> field in the document's metadata to <em>FILE</em>, overriding any value set in the metadata, and process citations using <code>pandoc-citeproc</code>. (This is equivalent to <code>--metadata bibliography=FILE --filter pandoc-citeproc</code>.) If <code>--natbib</code> or <code>--biblatex</code> is also supplied, <code>pandoc-citeproc</code> is not used, making this equivalent to <code>--metadata bibliography=FILE</code>. If you supply this argument multiple times, each <em>FILE</em> will be added to bibliography.</p>
</dd>
<dt><code>--csl=</code><em>FILE</em></dt>
<dd><p>Set the <code>csl</code> field in the document's metadata to <em>FILE</em>, overriding any value set in the metadata. (This is equivalent to <code>--metadata csl=FILE</code>.) This option is only relevant with <code>pandoc-citeproc</code>.</p>
</dd>
<dt><code>--citation-abbreviations=</code><em>FILE</em></dt>
<dd><p>Set the <code>citation-abbreviations</code> field in the document's metadata to <em>FILE</em>, overriding any value set in the metadata. (This is equivalent to <code>--metadata citation-abbreviations=FILE</code>.) This option is only relevant with <code>pandoc-citeproc</code>.</p>
</dd>
<dt><code>--natbib</code></dt>
<dd><p>Use <a href="https://ctan.org/pkg/natbib"><code>natbib</code></a> for citations in LaTeX output. This option is not for use with the <code>pandoc-citeproc</code> filter or with PDF output. It is intended for use in producing a LaTeX file that can be processed with <a href="https://ctan.org/pkg/bibtex"><code>bibtex</code></a>.</p>
</dd>
<dt><code>--biblatex</code></dt>
<dd><p>Use <a href="https://ctan.org/pkg/biblatex"><code>biblatex</code></a> for citations in LaTeX output. This option is not for use with the <code>pandoc-citeproc</code> filter or with PDF output. It is intended for use in producing a LaTeX file that can be processed with <a href="https://ctan.org/pkg/bibtex"><code>bibtex</code></a> or <a href="https://ctan.org/pkg/biber"><code>biber</code></a>.</p>
</dd>
</dl>
<h2 id="math-rendering-in-html">Math rendering in HTML</h2>
<dl>
<dt><code>-m</code> [<em>URL</em>], <code>--latexmathml</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Use the <a href="http://math.etsu.edu/LaTeXMathML/">LaTeXMathML</a> script to display embedded TeX math in HTML output. To insert a link to a local copy of the <code>LaTeXMathML.js</code> script, provide a <em>URL</em>. If no <em>URL</em> is provided, the contents of the script will be inserted directly into the HTML header, preserving portability at the price of efficiency. If you plan to use math on several pages, it is much better to link to a copy of the script, so it can be cached.</p>
</dd>
<dt><code>--mathml</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Convert TeX math to <a href="http://www.w3.org/Math/">MathML</a> (in <code>docbook</code> as well as <code>html</code> and <code>html5</code>). In standalone <code>html</code> output, a small javascript (or a link to such a script if a <em>URL</em> is supplied) will be inserted that allows the MathML to be viewed on some browsers.</p>
</dd>
<dt><code>--jsmath</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Use <a href="http://www.math.union.edu/~dpvc/jsmath/">jsMath</a> to display embedded TeX math in HTML output. The <em>URL</em> should point to the jsMath load script (e.g. <code>jsMath/easy/load.js</code>); if provided, it will be linked to in the header of standalone HTML documents. If a <em>URL</em> is not provided, no link to the jsMath load script will be inserted; it is then up to the author to provide such a link in the HTML template.</p>
</dd>
<dt><code>--mathjax</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Use <a href="https://www.mathjax.org">MathJax</a> to display embedded TeX math in HTML output. The <em>URL</em> should point to the <code>MathJax.js</code> load script. If a <em>URL</em> is not provided, a link to the MathJax CDN will be inserted.</p>
</dd>
<dt><code>--gladtex</code></dt>
<dd><p>Enclose TeX math in <code><eq></code> tags in HTML output. These can then be processed by <a href="http://ans.hsh.no/home/mgg/gladtex/">gladTeX</a> to produce links to images of the typeset formulas.</p>
</dd>
<dt><code>--mimetex</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Render TeX math using the <a href="http://www.forkosh.com/mimetex.html">mimeTeX</a> CGI script. If <em>URL</em> is not specified, it is assumed that the script is at <code>/cgi-bin/mimetex.cgi</code>.</p>
</dd>
<dt><code>--webtex</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Render TeX formulas using an external script that converts TeX formulas to images. The formula will be concatenated with the URL provided. If <em>URL</em> is not specified, the Google Chart API will be used.</p>
</dd>
<dt><code>--katex</code>[<code>=</code><em>URL</em>]</dt>
<dd><p>Use <a href="https://github.com/Khan/KaTeX">KaTeX</a> to display embedded TeX math in HTML output. The <em>URL</em> should point to the <code>katex.js</code> load script. If a <em>URL</em> is not provided, a link to the KaTeX CDN will be inserted.</p>
</dd>
<dt><code>--katex-stylesheet=</code><em>URL</em></dt>
<dd><p>The <em>URL</em> should point to the <code>katex.css</code> stylesheet. If this option is not specified, a link to the KaTeX CDN will be inserted. Note that this option does not imply <code>--katex</code>.</p>
</dd>
</dl>
<h2 id="options-for-wrapper-scripts">Options for wrapper scripts</h2>
<dl>
<dt><code>--dump-args</code></dt>
<dd><p>Print information about command-line arguments to <em>stdout</em>, then exit. This option is intended primarily for use in wrapper scripts. The first line of output contains the name of the output file specified with the <code>-o</code> option, or <code>-</code> (for <em>stdout</em>) if no output file was specified. The remaining lines contain the command-line arguments, one per line, in the order they appear. These do not include regular pandoc options and their arguments, but do include any options appearing after a <code>--</code> separator at the end of the line.</p>
</dd>
<dt><code>--ignore-args</code></dt>
<dd><p>Ignore command-line arguments (for use in wrapper scripts). Regular pandoc options are not ignored. Thus, for example,</p>
<pre><code>pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1</code></pre>
<p>is equivalent to</p>
<pre><code>pandoc -o foo.html -s</code></pre>
</dd>
</dl>
<h1 id="templates">Templates</h1>
<p>When the <code>-s/--standalone</code> option is used, pandoc uses a template to add header and footer material that is needed for a self-standing document. To see the default template that is used, just type</p>
<pre><code>pandoc -D *FORMAT*</code></pre>
<p>where <em>FORMAT</em> is the name of the output format. A custom template can be specified using the <code>--template</code> option. You can also override the system default templates for a given output format <em>FORMAT</em> by putting a file <code>templates/default.*FORMAT*</code> in the user data directory (see <code>--data-dir</code>, above). <em>Exceptions:</em> For <code>odt</code> output, customize the <code>default.opendocument</code> template. For <code>pdf</code> output, customize the <code>default.latex</code> template.</p>
<p>Templates contain <em>variables</em>, which allow for the inclusion of arbitrary information at any point in the file. Variables may be set within the document using <a href="#extension-yaml_metadata_block">YAML metadata blocks</a>. They may also be set at the command line using the <code>-V/--variable</code> option: variables set in this way override metadata fields with the same name.</p>
<h2 id="variables-set-by-pandoc">Variables set by pandoc</h2>
<p>Some variables are set automatically by pandoc. These vary somewhat depending on the output format, but include metadata fields as well as the following:</p>
<dl>
<dt><code>title</code>, <code>author</code>, <code>date</code></dt>
<dd><p>allow identification of basic aspects of the document. Included in PDF metadata through LaTeX and ConTeXt. These can be set through a <a href="#extension-pandoc_title_block">pandoc title block</a>, which allows for multiple authors, or through a YAML metadata block:</p>
<pre><code>---
author:
- Aristotle
- Peter Abelard
...</code></pre>
</dd>
<dt><code>subtitle</code></dt>
<dd>document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx; renders in LaTeX only when using a document class that supports <code>\subtitle</code>, such as <code>beamer</code> or the <a href="https://ctan.org/pkg/koma-script">KOMA-Script</a> series (<code>scrartcl</code>, <code>scrreprt</code>, <code>scrbook</code>).<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a>
</dd>
<dt><code>abstract</code></dt>
<dd>document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
</dd>
<dt><code>keywords</code></dt>
<dd>list of keywords to be included in HTML, PDF, and AsciiDoc metadata; may be repeated as for <code>author</code>, above
</dd>
<dt><code>header-includes</code></dt>
<dd>contents specified by <code>-H/--include-in-header</code> (may have multiple values)
</dd>
<dt><code>toc</code></dt>
<dd>non-null value if <code>--toc/--table-of-contents</code> was specified
</dd>
<dt><code>toc-title</code></dt>
<dd>title of table of contents (works only with EPUB and docx)
</dd>
<dt><code>include-before</code></dt>
<dd>contents specified by <code>-B/--include-before-body</code> (may have multiple values)
</dd>
<dt><code>include-after</code></dt>
<dd>contents specified by <code>-A/--include-after-body</code> (may have multiple values)
</dd>
<dt><code>body</code></dt>
<dd>body of document
</dd>
<dt><code>meta-json</code></dt>
<dd>JSON representation of all of the document's metadata
</dd>
</dl>
<h2 id="language-variables">Language variables</h2>
<dl>
<dt><code>lang</code></dt>
<dd><p>identifies the main language of the document, using a code according to <a href="https://tools.ietf.org/html/bcp47">BCP 47</a> (e.g. <code>en</code> or <code>en-GB</code>). For some output formats, pandoc will convert it to an appropriate format stored in the additional variables <code>babel-lang</code>, <code>polyglossia-lang</code> (LaTeX) and <code>context-lang</code> (ConTeXt).</p>
<p>Native pandoc <code>span</code>s and <code>div</code>s with the lang attribute (value in BCP 47) can be used to switch the language in that range.</p>
</dd>
<dt><code>otherlangs</code></dt>
<dd>a list of other languages used in the document in the YAML metadata, according to <a href="https://tools.ietf.org/html/bcp47">BCP 47</a>. For example: <code>otherlangs: [en-GB, fr]</code>. This is automatically generated from the <code>lang</code> attributes in all <code>span</code>s and <code>div</code>s but can be overridden. Currently only used by LaTeX through the generated <code>babel-otherlangs</code> and <code>polyglossia-otherlangs</code> variables. The LaTeX writer outputs polyglossia commands in the text but the <code>babel-newcommands</code> variable contains mappings for them to the corresponding babel.
</dd>
<dt><code>dir</code></dt>
<dd><p>the base direction of the document, either <code>rtl</code> (right-to-left) or <code>ltr</code> (left-to-right).</p>
<p>For bidirectional documents, native pandoc <code>span</code>s and <code>div</code>s with the <code>dir</code> attribute (value <code>rtl</code> or <code>ltr</code>) can be used to override the base direction in some output formats. This may not always be necessary if the final renderer (e.g. the browser, when generating HTML) supports the <a href="http://www.w3.org/International/articles/inline-bidi-markup/uba-basics">Unicode Bidirectional Algorithm</a>.</p>
<p>When using LaTeX for bidirectional documents, only the <code>xelatex</code> engine is fully supported (use <code>--latex-engine=xelatex</code>).</p>
</dd>
</dl>
<h2 id="variables-for-slides">Variables for slides</h2>
<p>Variables are available for <a href="#producing-slide-shows-with-pandoc">producing slide shows with pandoc</a>, including all <a href="https://github.com/hakimel/reveal.js#configuration">reveal.js configuration options</a>.</p>
<dl>
<dt><code>slidy-url</code></dt>
<dd>base URL for Slidy documents (defaults to <code>http://www.w3.org/Talks/Tools/Slidy2</code>)
</dd>
<dt><code>slideous-url</code></dt>
<dd>base URL for Slideous documents (defaults to <code>slideous</code>)
</dd>
<dt><code>s5-url</code></dt>
<dd>base URL for S5 documents (defaults to <code>s5/default</code>)
</dd>
<dt><code>revealjs-url</code></dt>
<dd>base URL for reveal.js documents (defaults to <code>reveal.js</code>)
</dd>
<dt><code>theme</code>, <code>colortheme</code>, <code>fonttheme</code>, <code>innertheme</code>, <code>outertheme</code></dt>
<dd>themes for LaTeX <a href="https://ctan.org/pkg/beamer"><code>beamer</code></a> documents
</dd>
<dt><code>navigation</code></dt>
<dd>controls navigation symbols in <code>beamer</code> documents (default is <code>empty</code> for no navigation symbols; other valid values are <code>frame</code>, <code>vertical</code>, and <code>horizontal</code>).
</dd>
<dt><code>section-titles</code></dt>
<dd>enables on "title pages" for new sections in <code>beamer</code> documents (default = true).
</dd>
</dl>
<h2 id="variables-for-latex">Variables for LaTeX</h2>
<p>LaTeX variables are used when <a href="#creating-a-pdf">creating a PDF</a>.</p>
<dl>
<dt><code>papersize</code></dt>
<dd>paper size, e.g. <code>letter</code>, <code>A4</code>
</dd>
<dt><code>fontsize</code></dt>
<dd>font size for body text (e.g. <code>10pt</code>, <code>12pt</code>)
</dd>
<dt><code>documentclass</code></dt>
<dd>document class, e.g. <a href="https://ctan.org/pkg/article"><code>article</code></a>, <a href="https://ctan.org/pkg/report"><code>report</code></a>, <a href="https://ctan.org/pkg/book"><code>book</code></a>, <a href="https://ctan.org/pkg/memoir"><code>memoir</code></a>
</dd>
<dt><code>classoption</code></dt>
<dd>option for document class, e.g. <code>oneside</code>; may be repeated for multiple options
</dd>
<dt><code>geometry</code></dt>
<dd>option for <a href="https://ctan.org/pkg/geometry"><code>geometry</code></a> package, e.g. <code>margin=1in</code>; may be repeated for multiple options
</dd>
<dt><code>margin-left</code>, <code>margin-right</code>, <code>margin-top</code>, <code>margin-bottom</code></dt>
<dd>sets margins, if <code>geometry</code> is not used (otherwise <code>geometry</code> overrides these)
</dd>
<dt><code>linestretch</code></dt>
<dd>adjusts line spacing using the <a href="https://ctan.org/pkg/setspace"><code>setspace</code></a> package, e.g. <code>1.25</code>, <code>1.5</code>
</dd>
<dt><code>fontfamily</code></dt>
<dd>font package for use with <code>pdflatex</code>: <a href="http://www.tug.org/texlive/">TeX Live</a> includes many options, documented in the <a href="http://www.tug.dk/FontCatalogue/">LaTeX Font Catalogue</a>. The default is <a href="https://ctan.org/pkg/lm">Latin Modern</a>.
</dd>
<dt><code>fontfamilyoptions</code></dt>
<dd>options for package used as <code>fontfamily</code>: e.g. <code>osf,sc</code> with <code>fontfamily</code> set to <a href="https://ctan.org/pkg/mathpazo"><code>mathpazo</code></a> provides Palatino with old-style figures and true small caps; may be repeated for multiple options
</dd>
<dt><code>mainfont</code>, <code>sansfont</code>, <code>monofont</code>, <code>mathfont</code>, <code>CJKmainfont</code></dt>
<dd>font families for use with <code>xelatex</code> or <code>lualatex</code>: take the name of any system font, using the <a href="https://ctan.org/pkg/fontspec"><code>fontspec</code></a> package. Note that if <code>CJKmainfont</code> is used, the <a href="https://ctan.org/pkg/xecjk"><code>xecjk</code></a> package must be available.
</dd>
<dt><code>mainfontoptions</code>, <code>sansfontoptions</code>, <code>monofontoptions</code>, <code>mathfontoptions</code>, <code>CJKoptions</code></dt>
<dd>options to use with <code>mainfont</code>, <code>sansfont</code>, <code>monofont</code>, <code>mathfont</code>, <code>CJKmainfont</code> in <code>xelatex</code> and <code>lualatex</code>. Allow for any choices available through <a href="https://ctan.org/pkg/fontspec"><code>fontspec</code></a>, such as the OpenType features <code>Numbers=OldStyle,Numbers=Proportional</code>. May be repeated for multiple options.
</dd>
<dt><code>fontenc</code></dt>
<dd>allows font encoding to be specified through <code>fontenc</code> package (with <code>pdflatex</code>); default is <code>T1</code> (see guide to <a href="https://ctan.org/pkg/encguide">LaTeX font encodings</a>)
</dd>
<dt><code>colorlinks</code></dt>
<dd>add color to link text; automatically enabled if any of <code>linkcolor</code>, <code>citecolor</code>, <code>urlcolor</code>, or <code>toccolor</code> are set
</dd>
<dt><code>linkcolor</code>, <code>citecolor</code>, <code>urlcolor</code>, <code>toccolor</code></dt>
<dd>color for internal links, citation links, external links, and links in table of contents: uses any of the <a href="https://en.wikibooks.org/wiki/LaTeX/Colors#Predefined_colors">predefined LaTeX colors</a>
</dd>
<dt><code>links-as-notes</code></dt>
<dd>causes links to be printed as footnotes
</dd>
<dt><code>indent</code></dt>
<dd>uses document class settings for indentation (the default LaTeX template otherwise removes indentation and adds space between paragraphs)
</dd>
<dt><code>subparagraph</code></dt>
<dd>disables default behavior of LaTeX template that redefines (sub)paragraphs as sections, changing the appearance of nested headings in some classes
</dd>
<dt><code>thanks</code></dt>
<dd>specifies contents of acknowledgments footnote after document title.
</dd>
<dt><code>toc</code></dt>
<dd>include table of contents (can also be set using <code>--toc/--table-of-contents</code>)
</dd>
<dt><code>toc-depth</code></dt>
<dd>level of section to include in table of contents
</dd>
<dt><code>lof</code>, <code>lot</code></dt>
<dd>include list of figures, list of tables
</dd>
<dt><code>bibliography</code></dt>
<dd>bibliography to use for resolving references
</dd>
<dt><code>biblio-style</code></dt>
<dd>bibliography style, when used with <code>--natbib</code> and <code>--biblatex</code>.
</dd>
<dt><code>biblatexoptions</code></dt>
<dd>list of options for biblatex.
</dd>
</dl>
<h2 id="variables-for-context">Variables for ConTeXt</h2>
<dl>
<dt><code>papersize</code></dt>
<dd>paper size, e.g. <code>letter</code>, <code>A4</code>, <code>landscape</code> (see <a href="http://wiki.contextgarden.net/PaperSetup">ConTeXt Paper Setup</a>); may be repeated for multiple options
</dd>
<dt><code>layout</code></dt>
<dd>options for page margins and text arrangement (see <a href="http://wiki.contextgarden.net/Layout">ConTeXt Layout</a>); may be repeated for multiple options
</dd>
<dt><code>margin-left</code>, <code>margin-right</code>, <code>margin-top</code>, <code>margin-bottom</code></dt>
<dd>sets margins, if <code>layout</code> is not used (otherwise <code>layout</code> overrides these)
</dd>
<dt><code>fontsize</code></dt>
<dd>font size for body text (e.g. <code>10pt</code>, <code>12pt</code>)
</dd>
<dt><code>mainfont</code>, <code>sansfont</code>, <code>monofont</code>, <code>mathfont</code></dt>
<dd>font families: take the name of any system font (see <a href="http://wiki.contextgarden.net/Font_Switching">ConTeXt Font Switching</a>)
</dd>
<dt><code>linkcolor</code>, <code>contrastcolor</code></dt>
<dd>color for links outside and inside a page, e.g. <code>red</code>, <code>blue</code> (see <a href="http://wiki.contextgarden.net/Color">ConTeXt Color</a>)
</dd>
<dt><code>linkstyle</code></dt>
<dd>typeface style for links, e.g. <code>normal</code>, <code>bold</code>, <code>slanted</code>, <code>boldslanted</code>, <code>type</code>, <code>cap</code>, <code>small</code>
</dd>
<dt><code>indenting</code></dt>
<dd>controls indentation of paragraphs, e.g. <code>yes,small,next</code> (see <a href="http://wiki.contextgarden.net/Indentation">ConTeXt Indentation</a>); may be repeated for multiple options
</dd>
<dt><code>whitespace</code></dt>
<dd>spacing between paragraphs, e.g. <code>none</code>, <code>small</code> (using <a href="http://wiki.contextgarden.net/Command/setupwhitespace"><code>setupwhitespace</code></a>)
</dd>
<dt><code>interlinespace</code></dt>
<dd>adjusts line spacing, e.g. <code>4ex</code> (using <a href="http://wiki.contextgarden.net/Command/setupinterlinespace"><code>setupinterlinespace</code></a>); may be repeated for multiple options
</dd>
<dt><code>headertext</code>, <code>footertext</code></dt>
<dd>text to be placed in running header or footer (see <a href="http://wiki.contextgarden.net/Headers_and_Footers">ConTeXt Headers and Footers</a>); may be repeated up to four times for different placement
</dd>
<dt><code>pagenumbering</code></dt>
<dd>page number style and location (using <a href="http://wiki.contextgarden.net/Command/setuppagenumbering"><code>setuppagenumbering</code></a>); may be repeated for multiple options
</dd>
<dt><code>toc</code></dt>
<dd>include table of contents (can also be set using <code>--toc/--table-of-contents</code>)
</dd>
<dt><code>lof</code>, <code>lot</code></dt>
<dd>include list of figures, list of tables
</dd>
</dl>
<h2 id="variables-for-man-pages">Variables for man pages</h2>
<dl>
<dt><code>section</code></dt>
<dd>section number in man pages
</dd>
<dt><code>header</code></dt>
<dd>header in man pages
</dd>
<dt><code>footer</code></dt>
<dd>footer in man pages
</dd>
<dt><code>adjusting</code></dt>
<dd>adjusts text to left (<code>l</code>), right (<code>r</code>), center (<code>c</code>), or both (<code>b</code>) margins
</dd>
<dt><code>hyphenate</code></dt>
<dd>if <code>true</code> (the default), hyphenation will be used
</dd>
</dl>
<h2 id="using-variables-in-templates">Using variables in templates</h2>
<p>Variable names are sequences of alphanumerics, <code>-</code>, and <code>_</code>, starting with a letter. A variable name surrounded by <code>$</code> signs will be replaced by its value. For example, the string <code>$title$</code> in</p>
<pre><code><title>$title$</title></code></pre>
<p>will be replaced by the document title.</p>
<p>To write a literal <code>$</code> in a template, use <code>$$</code>.</p>
<p>Templates may contain conditionals. The syntax is as follows:</p>
<pre><code>$if(variable)$
X
$else$
Y
$endif$</code></pre>
<p>This will include <code>X</code> in the template if <code>variable</code> has a non-null value; otherwise it will include <code>Y</code>. <code>X</code> and <code>Y</code> are placeholders for any valid template text, and may include interpolated variables or other conditionals. The <code>$else$</code> section may be omitted.</p>
<p>When variables can have multiple values (for example, <code>author</code> in a multi-author document), you can use the <code>$for$</code> keyword:</p>
<pre><code>$for(author)$
<meta name="author" content="$author$" />
$endfor$</code></pre>
<p>You can optionally specify a separator to be used between consecutive items:</p>
<pre><code>$for(author)$$author$$sep$, $endfor$</code></pre>
<p>A dot can be used to select a field of a variable that takes an object as its value. So, for example:</p>
<pre><code>$author.name$ ($author.affiliation$)</code></pre>
<p>If you use custom templates, you may need to revise them as pandoc changes. We recommend tracking the changes in the default templates, and modifying your custom templates accordingly. An easy way to do this is to fork the <a href="https://github.com/jgm/pandoc-templates">pandoc-templates</a> repository and merge in changes after each pandoc release.</p>
<h1 id="pandocs-markdown">Pandoc's Markdown</h1>
<p>Pandoc understands an extended and slightly revised version of John Gruber's <a href="http://daringfireball.net/projects/markdown/">Markdown</a> syntax. This document explains the syntax, noting differences from standard Markdown. Except where noted, these differences can be suppressed by using the <code>markdown_strict</code> format instead of <code>markdown</code>. An extensions can be enabled by adding <code>+EXTENSION</code> to the format name and disabled by adding <code>-EXTENSION</code>. For example, <code>markdown_strict+footnotes</code> is strict Markdown with footnotes enabled, while <code>markdown-footnotes-pipe_tables</code> is pandoc's Markdown without footnotes or pipe tables.</p>
<h2 id="philosophy">Philosophy</h2>
<p>Markdown is designed to be easy to write, and, even more importantly, easy to read:</p>
<blockquote>
<p>A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions. -- <a href="http://daringfireball.net/projects/markdown/syntax#philosophy">John Gruber</a></p>
</blockquote>
<p>This principle has guided pandoc's decisions in finding syntax for tables, footnotes, and other extensions.</p>
<p>There is, however, one respect in which pandoc's aims are different from the original aims of Markdown. Whereas Markdown was originally designed with HTML generation in mind, pandoc is designed for multiple output formats. Thus, while pandoc allows the embedding of raw HTML, it discourages it, and provides other, non-HTMLish ways of representing important document elements like definition lists, tables, mathematics, and footnotes.</p>
<h2 id="paragraphs">Paragraphs</h2>
<p>A paragraph is one or more lines of text followed by one or more blank lines. Newlines are treated as spaces, so you can reflow your paragraphs as you like. If you need a hard line break, put two or more spaces at the end of a line.</p>
<h4 id="extension-escaped_line_breaks">Extension: <code>escaped_line_breaks</code></h4>
<p>A backslash followed by a newline is also a hard line break. Note: in multiline and grid table cells, this is the only way to create a hard line break, since trailing spaces in the cells are ignored.</p>
<h2 id="headers">Headers</h2>
<p>There are two kinds of headers: Setext and ATX.</p>
<h3 id="setext-style-headers">Setext-style headers</h3>
<p>A setext-style header is a line of text "underlined" with a row of <code>=</code> signs (for a level one header) or <code>-</code> signs (for a level two header):</p>
<pre><code>A level-one header
==================
A level-two header
------------------</code></pre>
<p>The header text can contain inline formatting, such as emphasis (see <a href="#inline-formatting">Inline formatting</a>, below).</p>
<h3 id="atx-style-headers">ATX-style headers</h3>
<p>An ATX-style header consists of one to six <code>#</code> signs and a line of text, optionally followed by any number of <code>#</code> signs. The number of <code>#</code> signs at the beginning of the line is the header level:</p>
<pre><code>## A level-two header
### A level-three header ###</code></pre>
<p>As with setext-style headers, the header text can contain formatting:</p>
<pre><code># A level-one header with a [link](/url) and *emphasis*</code></pre>
<h4 id="extension-blank_before_header">Extension: <code>blank_before_header</code></h4>
<p>Standard Markdown syntax does not require a blank line before a header. Pandoc does require this (except, of course, at the beginning of the document). The reason for the requirement is that it is all too easy for a <code>#</code> to end up at the beginning of a line by accident (perhaps through line wrapping). Consider, for example:</p>
<pre><code>I like several of their flavors of ice cream:
#22, for example, and #5.</code></pre>
<h3 id="header-identifiers">Header identifiers</h3>
<h4 id="extension-header_attributes">Extension: <code>header_attributes</code></h4>
<p>Headers can be assigned attributes using this syntax at the end of the line containing the header text:</p>
<pre><code>{#identifier .class .class key=value key=value}</code></pre>
<p>Thus, for example, the following headers will all be assigned the identifier <code>foo</code>:</p>
<pre><code># My header {#foo}
## My header ## {#foo}
My other header {#foo}
---------------</code></pre>
<p>(This syntax is compatible with <a href="https://michelf.ca/projects/php-markdown/extra/">PHP Markdown Extra</a>.)</p>
<p>Note that although this syntax allows assignment of classes and key/value attributes, writers generally don't use all of this information. Identifiers, classes, and key/value attributes are used in HTML and HTML-based formats such as EPUB and slidy. Identifiers are used for labels and link anchors in the LaTeX, ConTeXt, Textile, and AsciiDoc writers.</p>
<p>Headers with the class <code>unnumbered</code> will not be numbered, even if <code>--number-sections</code> is specified. A single hyphen (<code>-</code>) in an attribute context is equivalent to <code>.unnumbered</code>, and preferable in non-English documents. So,</p>
<pre><code># My header {-}</code></pre>
<p>is just the same as</p>
<pre><code># My header {.unnumbered}</code></pre>
<h4 id="extension-auto_identifiers">Extension: <code>auto_identifiers</code></h4>
<p>A header without an explicitly specified identifier will be automatically assigned a unique identifier based on the header text. To derive the identifier from the header text,</p>
<ul>
<li>Remove all formatting, links, etc.</li>
<li>Remove all footnotes.</li>
<li>Remove all punctuation, except underscores, hyphens, and periods.</li>
<li>Replace all spaces and newlines with hyphens.</li>
<li>Convert all alphabetic characters to lowercase.</li>
<li>Remove everything up to the first letter (identifiers may not begin with a number or punctuation mark).</li>
<li>If nothing is left after this, use the identifier <code>section</code>.</li>
</ul>
<p>Thus, for example,</p>
<table>
<thead>
<tr class="header">
<th align="left">Header</th>
<th align="left">Identifier</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left"><code>Header identifiers in HTML</code></td>
<td align="left"><code>header-identifiers-in-html</code></td>
</tr>
<tr class="even">
<td align="left"><code>*Dogs*?--in *my* house?</code></td>
<td align="left"><code>dogs--in-my-house</code></td>
</tr>
<tr class="odd">
<td align="left"><code>[HTML], [S5], or [RTF]?</code></td>
<td align="left"><code>html-s5-or-rtf</code></td>
</tr>
<tr class="even">
<td align="left"><code>3. Applications</code></td>
<td align="left"><code>applications</code></td>
</tr>
<tr class="odd">
<td align="left"><code>33</code></td>
<td align="left"><code>section</code></td>
</tr>
</tbody>
</table>
<p>These rules should, in most cases, allow one to determine the identifier from the header text. The exception is when several headers have the same text; in this case, the first will get an identifier as described above; the second will get the same identifier with <code>-1</code> appended; the third with <code>-2</code>; and so on.</p>
<p>These identifiers are used to provide link targets in the table of contents generated by the <code>--toc|--table-of-contents</code> option. They also make it easy to provide links from one section of a document to another. A link to this section, for example, might look like this:</p>
<pre><code>See the section on
[header identifiers](#header-identifiers-in-html-latex-and-context).</code></pre>
<p>Note, however, that this method of providing links to sections works only in HTML, LaTeX, and ConTeXt formats.</p>
<p>If the <code>--section-divs</code> option is specified, then each section will be wrapped in a <code>div</code> (or a <code>section</code>, if <code>--html5</code> was specified), and the identifier will be attached to the enclosing <code><div></code> (or <code><section></code>) tag rather than the header itself. This allows entire sections to be manipulated using javascript or treated differently in CSS.</p>
<h4 id="extension-implicit_header_references">Extension: <code>implicit_header_references</code></h4>
<p>Pandoc behaves as if reference links have been defined for each header. So, instead of</p>
<pre><code>[header identifiers](#header-identifiers-in-html)</code></pre>
<p>you can simply write</p>
<pre><code>[header identifiers]</code></pre>
<p>or</p>
<pre><code>[header identifiers][]</code></pre>
<p>or</p>
<pre><code>[the section on header identifiers][header identifiers]</code></pre>
<p>If there are multiple headers with identical text, the corresponding reference will link to the first one only, and you will need to use explicit links to link to the others, as described above.</p>
<p>Like regular reference links, these references are case-insensitive.</p>
<p>Explicit link reference definitions always take priority over implicit header references. So, in the following example, the link will point to <code>bar</code>, not to <code>#foo</code>:</p>
<pre><code># Foo
[foo]: bar
See [foo]</code></pre>
<h2 id="block-quotations">Block quotations</h2>
<p>Markdown uses email conventions for quoting blocks of text. A block quotation is one or more paragraphs or other block elements (such as lists or headers), with each line preceded by a <code>></code> character and an optional space. (The <code>></code> need not start at the left margin, but it should not be indented more than three spaces.)</p>
<pre><code>> This is a block quote. This
> paragraph has two lines.
>
> 1. This is a list inside a block quote.
> 2. Second item.</code></pre>
<p>A "lazy" form, which requires the <code>></code> character only on the first line of each block, is also allowed:</p>
<pre><code>> This is a block quote. This
paragraph has two lines.
> 1. This is a list inside a block quote.
2. Second item.</code></pre>
<p>Among the block elements that can be contained in a block quote are other block quotes. That is, block quotes can be nested:</p>
<pre><code>> This is a block quote.
>
> > A block quote within a block quote.</code></pre>
<p>If the <code>></code> character is followed by an optional space, that space will be considered part of the block quote marker and not part of the indentation of the contents. Thus, to put an indented code block in a block quote, you need five spaces after the <code>></code>:</p>
<pre><code>> code</code></pre>
<h4 id="extension-blank_before_blockquote">Extension: <code>blank_before_blockquote</code></h4>
<p>Standard Markdown syntax does not require a blank line before a block quote. Pandoc does require this (except, of course, at the beginning of the document). The reason for the requirement is that it is all too easy for a <code>></code> to end up at the beginning of a line by accident (perhaps through line wrapping). So, unless the <code>markdown_strict</code> format is used, the following does not produce a nested block quote in pandoc:</p>
<pre><code>> This is a block quote.
>> Nested.</code></pre>
<h2 id="verbatim-code-blocks">Verbatim (code) blocks</h2>
<h3 id="indented-code-blocks">Indented code blocks</h3>
<p>A block of text indented four spaces (or one tab) is treated as verbatim text: that is, special characters do not trigger special formatting, and all spaces and line breaks are preserved. For example,</p>
<pre><code> if (a > 3) {
moveShip(5 * gravity, DOWN);
}</code></pre>
<p>The initial (four space or one tab) indentation is not considered part of the verbatim text, and is removed in the output.</p>
<p>Note: blank lines in the verbatim text need not begin with four spaces.</p>
<h3 id="fenced-code-blocks">Fenced code blocks</h3>
<h4 id="extension-fenced_code_blocks">Extension: <code>fenced_code_blocks</code></h4>
<p>In addition to standard indented code blocks, pandoc supports <em>fenced</em> code blocks. These begin with a row of three or more tildes (<code>~</code>) and end with a row of tildes that must be at least as long as the starting row. Everything between these lines is treated as code. No indentation is necessary:</p>
<pre><code>~~~~~~~
if (a > 3) {
moveShip(5 * gravity, DOWN);
}
~~~~~~~</code></pre>
<p>Like regular code blocks, fenced code blocks must be separated from surrounding text by blank lines.</p>
<p>If the code itself contains a row of tildes or backticks, just use a longer row of tildes or backticks at the start and end:</p>
<pre><code>~~~~~~~~~~~~~~~~
~~~~~~~~~~
code including tildes
~~~~~~~~~~
~~~~~~~~~~~~~~~~</code></pre>
<h4 id="extension-backtick_code_blocks">Extension: <code>backtick_code_blocks</code></h4>
<p>Same as <code>fenced_code_blocks</code>, but uses backticks (<code>`</code>) instead of tildes (<code>~</code>).</p>
<h4 id="extension-fenced_code_attributes">Extension: <code>fenced_code_attributes</code></h4>
<p>Optionally, you may attach attributes to fenced or backtick code block using this syntax:</p>
<pre><code>~~~~ {#mycode .haskell .numberLines startFrom="100"}
qsort [] = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
qsort (filter (>= x) xs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code></pre>
<p>Here <code>mycode</code> is an identifier, <code>haskell</code> and <code>numberLines</code> are classes, and <code>startFrom</code> is an attribute with value <code>100</code>. Some output formats can use this information to do syntax highlighting. Currently, the only output formats that uses this information are HTML and LaTeX. If highlighting is supported for your output format and language, then the code block above will appear highlighted, with numbered lines. (To see which languages are supported, do <code>pandoc --version</code>.) Otherwise, the code block above will appear as follows:</p>
<pre><code><pre id="mycode" class="haskell numberLines" startFrom="100">
<code>
...
</code>
</pre></code></pre>
<p>A shortcut form can also be used for specifying the language of the code block:</p>
<pre><code>```haskell
qsort [] = []
```</code></pre>
<p>This is equivalent to:</p>
<pre><code>``` {.haskell}
qsort [] = []
```</code></pre>
<p>If the <code>fenced_code_attributes</code> extension is disabled, but input contains class attribute(s) for the codeblock, the first class attribute will be printed after the opening fence as a bare word.</p>
<p>To prevent all highlighting, use the <code>--no-highlight</code> flag. To set the highlighting style, use <code>--highlight-style</code>. For more information on highlighting, see <a href="#syntax-highlighting">Syntax highlighting</a>, below.</p>
<h2 id="line-blocks">Line blocks</h2>
<h4 id="extension-line_blocks">Extension: <code>line_blocks</code></h4>
<p>A line block is a sequence of lines beginning with a vertical bar (<code>|</code>) followed by a space. The division into lines will be preserved in the output, as will any leading spaces; otherwise, the lines will be formatted as Markdown. This is useful for verse and addresses:</p>
<pre><code>| The limerick packs laughs anatomical
| In space that is quite economical.
| But the good ones I've seen
| So seldom are clean
| And the clean ones so seldom are comical
| 200 Main St.
| Berkeley, CA 94718</code></pre>
<p>The lines can be hard-wrapped if needed, but the continuation line must begin with a space.</p>
<pre><code>| The Right Honorable Most Venerable and Righteous Samuel L.
Constable, Jr.
| 200 Main St.
| Berkeley, CA 94718</code></pre>
<p>This syntax is borrowed from <a href="http://docutils.sourceforge.net/docs/ref/rst/introduction.html">reStructuredText</a>.</p>
<h2 id="lists">Lists</h2>
<h3 id="bullet-lists">Bullet lists</h3>
<p>A bullet list is a list of bulleted list items. A bulleted list item begins with a bullet (<code>*</code>, <code>+</code>, or <code>-</code>). Here is a simple example:</p>
<pre><code>* one
* two
* three</code></pre>
<p>This will produce a "compact" list. If you want a "loose" list, in which each item is formatted as a paragraph, put spaces between the items:</p>
<pre><code>* one
* two
* three</code></pre>
<p>The bullets need not be flush with the left margin; they may be indented one, two, or three spaces. The bullet must be followed by whitespace.</p>
<p>List items look best if subsequent lines are flush with the first line (after the bullet):</p>
<pre><code>* here is my first
list item.
* and my second.</code></pre>
<p>But Markdown also allows a "lazy" format:</p>
<pre><code>* here is my first
list item.
* and my second.</code></pre>
<h3 id="the-four-space-rule">The four-space rule</h3>
<p>A list item may contain multiple paragraphs and other block-level content. However, subsequent paragraphs must be preceded by a blank line and indented four spaces or a tab. The list will look better if the first paragraph is aligned with the rest:</p>
<pre><code> * First paragraph.
Continued.
* Second paragraph. With a code block, which must be indented
eight spaces:
{ code }</code></pre>
<p>List items may include other lists. In this case the preceding blank line is optional. The nested list must be indented four spaces or one tab:</p>
<pre><code>* fruits
+ apples
- macintosh
- red delicious
+ pears
+ peaches
* vegetables
+ broccoli
+ chard</code></pre>
<p>As noted above, Markdown allows you to write list items "lazily," instead of indenting continuation lines. However, if there are multiple paragraphs or other blocks in a list item, the first line of each must be indented.</p>
<pre><code>+ A lazy, lazy, list
item.
+ Another one; this looks
bad but is legal.
Second paragraph of second
list item.</code></pre>
<p><strong>Note:</strong> Although the four-space rule for continuation paragraphs comes from the official <a href="http://daringfireball.net/projects/markdown/syntax#list">Markdown syntax guide</a>, the reference implementation, <code>Markdown.pl</code>, does not follow it. So pandoc will give different results than <code>Markdown.pl</code> when authors have indented continuation paragraphs fewer than four spaces.</p>
<p>The <a href="http://daringfireball.net/projects/markdown/syntax#list">Markdown syntax guide</a> is not explicit whether the four-space rule applies to <em>all</em> block-level content in a list item; it only mentions paragraphs and code blocks. But it implies that the rule applies to all block-level content (including nested lists), and pandoc interprets it that way.</p>
<h3 id="ordered-lists">Ordered lists</h3>
<p>Ordered lists work just like bulleted lists, except that the items begin with enumerators rather than bullets.</p>
<p>In standard Markdown, enumerators are decimal numbers followed by a period and a space. The numbers themselves are ignored, so there is no difference between this list:</p>
<pre><code>1. one
2. two
3. three</code></pre>
<p>and this one:</p>
<pre><code>5. one
7. two
1. three</code></pre>
<h4 id="extension-fancy_lists">Extension: <code>fancy_lists</code></h4>
<p>Unlike standard Markdown, pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to arabic numerals. List markers may be enclosed in parentheses or followed by a single right-parentheses or period. They must be separated from the text that follows by at least one space, and, if the list marker is a capital letter with a period, by at least two spaces.<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a></p>
<p>The <code>fancy_lists</code> extension also allows '<code>#</code>' to be used as an ordered list marker in place of a numeral:</p>
<pre><code>#. one
#. two</code></pre>
<h4 id="extension-startnum">Extension: <code>startnum</code></h4>
<p>Pandoc also pays attention to the type of list marker used, and to the starting number, and both of these are preserved where possible in the output format. Thus, the following yields a list with numbers followed by a single parenthesis, starting with 9, and a sublist with lowercase roman numerals:</p>
<pre><code> 9) Ninth
10) Tenth
11) Eleventh
i. subone
ii. subtwo
iii. subthree</code></pre>
<p>Pandoc will start a new list each time a different type of list marker is used. So, the following will create three lists:</p>
<pre><code>(2) Two
(5) Three
1. Four
* Five</code></pre>
<p>If default list markers are desired, use <code>#.</code>:</p>
<pre><code>#. one
#. two