@@ -11,10 +11,11 @@ title: Pandoc Lua Filters
1111Pandoc has long supported filters, which allow the pandoc
1212abstract syntax tree (AST) to be manipulated between the parsing
1313and the writing phase. [Traditional pandoc
14−filters](https://pandoc.org/filters.html) accept a JSON representation of the
15−pandoc AST and produce an altered JSON representation of the
16−AST. They may be written in any programming language, and
17−invoked from pandoc using the `--filter` option.
14+filters](https://pandoc.org/filters.html) accept a JSON
15+representation of the pandoc AST and produce an altered JSON
16+representation of the AST. They may be written in any
17+programming language, and invoked from pandoc using the
18+`--filter` option.
1819
1920Although traditional filters are very flexible, they have a
2021couple of disadvantages. First, there is some overhead in
@@ -66,12 +67,12 @@ manual (MANUAL.txt) to HTML, with versions of the same JSON
6667filter written in compiled Haskell (`smallcaps`) and interpreted
6768Python (`smallcaps.py`):
6869
69− Command Time
70− ----------------------------------------- -------
71− `pandoc` 1.01s
72− `pandoc --filter ./smallcaps` 1.36s
73− `pandoc --filter ./smallcaps.py` 1.40s
74− `pandoc --lua-filter ./smallcaps.lua` 1.03s
70+ Command Time
71+ --------------------------------------- -------
72+ `pandoc` 1.01s
73+ `pandoc --filter ./smallcaps` 1.36s
74+ `pandoc --filter ./smallcaps.py` 1.40s
75+ `pandoc --lua-filter ./smallcaps.lua` 1.03s
7576
7677As you can see, the lua filter avoids the substantial overhead
7778associated with marshalling to and from JSON over a pipe.
@@ -114,9 +115,9 @@ The return of a filter function must one of the following:
114115- a pandoc object: this must be of the same type as the input
115116 and will replace the original object.
116117- a list of pandoc objects: these will replace the original
117− object; the list is merged with the neighbors of the original
118− objects (spliced into the list the original object belongs
119− to); returning an empty list deletes the object.
118+ object; the list is merged with the neighbors of the
119+ original objects (spliced into the list the original object
120+ belongs to); returning an empty list deletes the object.
120121
121122The function's output must result in an element of the same type
122123as the input. This means a filter function acting on an inline
@@ -135,7 +136,6 @@ Elements without matching functions are left untouched.
135136See [module documentation](#module-pandoc) for a list of pandoc
136137elements.
137138
138−
139139## Global variables
140140
141141Pandoc passes additional data to Lua filters by setting global
@@ -151,12 +151,13 @@ variables.
151151: Table of the options which were provided to the parser.
152152
153153`PANDOC_VERSION`
154−: Contains the pandoc version as a [Version object] which
155− behaves like a numerically indexed table, most significant
156− number first. E.g., for pandoc 2.7.3, the value of the
157− variable is equivalent to a table `{2, 7, 3}`. Use
158− `tostring(PANDOC_VERSION)` to produce a version string. This
159− variable is also set in custom writers.
154+: Contains the pandoc version as a [Version
155+ object](#type-ref-Version) which behaves like a numerically
156+ indexed table, most significant number first. E.g., for
157+ pandoc 2.7.3, the value of the variable is equivalent to a
158+ table `{2, 7, 3}`. Use `tostring(PANDOC_VERSION)` to produce
159+ a version string. This variable is also set in custom
160+ writers.
160161
161162`PANDOC_API_VERSION`
162163: Contains the version of the pandoc-types API against which
@@ -178,8 +179,6 @@ variables.
178179 variable is of type [CommonState](#type-ref-CommonState) and
179180 is read-only.
180181
181−[Version object]: #type-ref-Version
182−
183182# Pandoc Module
184183
185184The `pandoc` lua module is loaded into the filter's lua
@@ -228,8 +227,8 @@ default modules.
228227
229228The following snippet is an example of code that might be useful
230229when added to `init.lua`. The snippet adds all unicode-aware
231−functions defined in the [`text` module] to the default `string`
232−module, prefixed with the string `uc_`.
230+functions defined in the [`text` module](#module-text) to the
231+default `string` module, prefixed with the string `uc_`.
233232
234233``` {.lua}
235234for name, fn in pairs(require 'text') do
@@ -240,14 +239,11 @@ end
240239This makes it possible to apply these functions on strings using
241240colon syntax (`mystring:uc_upper()`).
242241
243−[`text` module]: #module-text
244−
245242# Examples
246243
247−The following filters are presented as examples.
248−A repository of useful lua filters (which may also serve
249−as good examples) is available at
250−<https://github.com/pandoc/lua-filters>.
244+The following filters are presented as examples. A repository of
245+useful lua filters (which may also serve as good examples) is
246+available at <https://github.com/pandoc/lua-filters>.
251247
252248## Macro substitution.
253249
@@ -552,13 +548,14 @@ end
552548
553549This filter converts raw LaTeX tikz environments into images. It
554550works with both PDF and HTML output. The tikz code is compiled
555−to an image using `pdflatex`, and the image is converted from pdf
556−to svg format using [`pdf2svg`](https://github.com/dawbarton/pdf2svg),
557−so both of these must be in the system path. Converted images
558−are cached in the working directory and given filenames based on
559−a hash of the source, so that they need not be regenerated each
560−time the document is built. (A more sophisticated version of
561−this might put these in a special cache directory.)
551+to an image using `pdflatex`, and the image is converted from
552+pdf to svg format using
553+[`pdf2svg`](https://github.com/dawbarton/pdf2svg), so both of
554+these must be in the system path. Converted images are cached in
555+the working directory and given filenames based on a hash of the
556+source, so that they need not be regenerated each time the
557+document is built. (A more sophisticated version of this might
558+put these in a special cache directory.)
562559
563560``` {.lua}
564561local function tikz2image(src, filetype, outfile)
@@ -637,12 +634,11 @@ Example of use:
637634 \end{tikzpicture}
638635 EOF
639636
640−
641637# Lua type reference
642638
643639This section describes the types of objects available to Lua
644−filters. See the [pandoc module](#module-pandoc}) for functions
645−to create these objects.
640+filters. See the [pandoc module](#module-pandoc%7D) for
641+functions to create these objects.
646642
647643## Shared Properties
648644
@@ -666,16 +662,16 @@ Object equality is determined via
666662[`pandoc.utils.equals`](#utils-equals).
667663
668664`blocks`
669−: document content ([List] of [Block]s)
665+: document content ([List](#module-pandoc.list) of
666+ [Block](#type-ref-Block)s)
670667
671668`meta`
672−: document meta information ([Meta] object)
673−
669+: document meta information ([Meta](#Meta) object)
674670
675671## Meta {#type-ref-meta}
676672
677673Meta information on a document; string-indexed collection of
678−[MetaValue]s.
674+[MetaValue](#type-ref-MetaValue)s.
679675
680676Object equality is determined via
681677[`pandoc.utils.equals`](#utils-equals).
@@ -689,7 +685,8 @@ Object equality is determined via
689685
690686### MetaBlocks {#type-ref-MetaBlocks}
691687
692−A list of blocks usable as meta value ([List] of [Block]s)
688+A list of blocks usable as meta value
689+([List](#module-pandoc.list) of [Block](#type-ref-Block)s)
693690
694691Fields:
695692
@@ -702,7 +699,8 @@ Plain Lua boolean value (boolean)
702699
703700### MetaInlines {#type-ref-MetaInlines}
704701
705−List of inlines used in metadata ([List] of [Inline]s)
702+List of inlines used in metadata ([List](#module-pandoc.list) of
703+[Inline](#type-ref-Inline)s)
706704
707705Fields:
708706
@@ -711,7 +709,8 @@ Fields:
711709
712710### MetaList {#type-ref-iMetaList}
713711
714−A list of other [MetaValue]s. ([List])
712+A list of other [MetaValue](#type-ref-MetaValue)s.
713+([List](#module-pandoc.list))
715714
716715Fields:
717716
@@ -734,7 +733,6 @@ with the same name as those listed.
734733
735734Plain Lua string value (string)
736735
737−
738736## Block {#type-ref-Block}
739737
740738Object equality is determined via
@@ -745,7 +743,8 @@ Object equality is determined via
745743A block quote element
746744
747745content:
748−: block content ([List] of [Block]s)
746+: block content ([List](#module-pandoc.list) of
747+ [Block](#type-ref-Block)s)
749748
750749`tag`, `t`
751750: the literal `BlockQuote` (string)
@@ -755,7 +754,8 @@ content:
755754A bullet list
756755
757756`content`
758−: list of items ([List] of [Block]s)
757+: list of items ([List](#module-pandoc.list) of
758+ [Block](#type-ref-Block)s)
759759
760760`tag`, `t`
761761: the literal `BulletList` (string)
@@ -768,16 +768,18 @@ Block of code.
768768: code string (string)
769769
770770`attr`
771−: element attributes ([Attr])
771+: element attributes ([Attr](#type-ref-Attr))
772772
773773`identifier`
774774: alias for `attr.identifier` (string)
775775
776776`classes`
777−: alias for `attr.classes` ([List] of strings)
777+: alias for `attr.classes` ([List](#module-pandoc.list) of
778+ strings)
778779
779780`attributes`
780−: alias for `attr.attributes` ([Attributes])
781+: alias for `attr.attributes`
782+ ([Attributes](#type-ref-Attributes))
781783
782784`tag`, `t`
783785: the literal `CodeBlock` (string)
@@ -797,19 +799,22 @@ Definition list, containing terms and their explanation.
797799Generic block container with attributes
798800
799801`content`
800−: block content ([List] of [Block]s)
802+: block content ([List](#module-pandoc.list) of
803+ [Block](#type-ref-Block)s)
801804
802805`attr`
803−: element attributes ([Attr])
806+: element attributes ([Attr](#type-ref-Attr))
804807
805808`identifier`
806809: alias for `attr.identifier` (string)
807810
808811`classes`
809−: alias for `attr.classes` ([List] of strings)
812+: alias for `attr.classes` ([List](#module-pandoc.list) of
813+ strings)
810814
811815`attributes`
812−: alias for `attr.attributes` ([Attributes])
816+: alias for `attr.attributes`
817+ ([Attributes](#type-ref-Attributes))
813818
814819`tag`, `t`
815820: the literal `Div` (string)
@@ -822,24 +827,26 @@ Creates a header element.
822827: header level (integer)
823828
824829`content`
825−: inline content ([List] of [Inline]s)
830+: inline content ([List](#module-pandoc.list) of
831+ [Inline](#type-ref-Inline)s)
826832
827833`attr`
828−: element attributes ([Attr])
834+: element attributes ([Attr](#type-ref-Attr))
829835
830836`identifier`
831837: alias for `attr.identifier` (string)
832838
833839`classes`
834−: alias for `attr.classes` ([List] of strings)
840+: alias for `attr.classes` ([List](#module-pandoc.list) of
841+ strings)
835842
836843`attributes`
837−: alias for `attr.attributes` ([Attributes])
844+: alias for `attr.attributes`
845+ ([Attributes](#type-ref-Attributes))
838846
839847`tag`, `t`
840848: the literal `Header` (string)
841849
842−
843850### HorizontalRule {#type-ref-HorizontalRule}
844851
845852A horizontal rule.
@@ -849,7 +856,7 @@ A horizontal rule.
849856
850857### LineBlock {#type-ref-LineBlock}
851858
852−A line block, i.e. a list of lines, each separated from the next
859+A line block, i.e. a list of lines, each separated from the next
853860by a newline.
854861
855862`content`
@@ -871,10 +878,11 @@ target format.
871878An ordered list.
872879
873880`content`
874−: list items ([List] of [Block]s)
881+: list items ([List](#module-pandoc.list) of
882+ [Block](#type-ref-Block)s)
875883
876884`listAttributes`
877−: list parameters ([ListAttributes])
885+: list parameters ([ListAttributes](#ListAttributes))
878886
879887`start`
880888: alias for `listAttributes.start` (integer)
@@ -893,7 +901,8 @@ An ordered list.
893901A paragraph
894902
895903`content`
896−: inline content ([List] of [Inline]s)
904+: inline content ([List](#module-pandoc.list) of
905+ [Inline](#type-ref-Inline)s)
897906
898907`tag`, `t`
899908: the literal `Para` (string)
@@ -903,7 +912,8 @@ A paragraph
903912Plain text, not a paragraph
904913
905914`content`
906−: inline content ([List] of [Inline]s)
915+: inline content ([List](#module-pandoc.list) of
916+ [Inline](#type-ref-Inline)s)
907917
908918`tag`, `t`
909919: the literal `Plain` (string)
@@ -926,19 +936,24 @@ Raw content of a specified format.
926936A table.
927937
928938`caption`
929−: table caption ([List] of [Inline]s)
939+: table caption ([List](#module-pandoc.list) of
940+ [Inline](#type-ref-Inline)s)
930941
931942`aligns`
932−: column alignments ([List] of [Alignment]s)
943+: column alignments ([List](#module-pandoc.list) of
944+ [Alignment](#type-ref-Alignment)s)
933945
934946`widths`
935947: column widths (number)
936948
937949`headers`
938−: header row ([List] of [table cells])
950+: header row ([List](#module-pandoc.list) of [table
951+ cells](#type-ref-table-cell))
939952
940953`rows`
941−: table rows ([List] of [List]s of [table cells])
954+: table rows ([List](#module-pandoc.list) of
955+ [List](#module-pandoc.list)s of [table
956+ cells](#type-ref-table-cell))
942957
943958`tag`, `t`
944959: the literal `Table` (string)
@@ -952,64 +967,70 @@ left-aligned, right-aligned, and centered, respectively. The
952967default alignment is `AlignDefault` (often equivalent to
953968centered).
954969
955−[Alignment]: #type-ref-Alignment
956−[table cells]: #type-ref-table-cell
957−
958970## Inline {#type-ref-Inline}
959971
960972Object equality is determined via
961973[`pandoc.utils.equals`](#utils-equals).
962974
963975### Cite {#type-ref-Cite}
976+
964977Citation
965978
966979`content`
967−: ([List] of [Inline]s)
980+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
968981
969982`citations`
970−: citation entries ([List] of [citations])
983+: citation entries ([List](#module-pandoc.list) of
984+ [citations](#type-ref-Citation))
971985
972986`tag`, `t`
973987: the literal `Cite` (string)
974988
975989### Code {#type-ref-Code}
990+
976991Inline code
977992
978993`text`
979994: code string (string)
980995
981996`attr`
982−: attributes ([Attr])
997+: attributes ([Attr](#type-ref-Attr))
983998
984999`identifier`
9851000: alias for `attr.identifier` (string)
9861001
9871002`classes`
988−: alias for `attr.classes` ([List] of strings)
1003+: alias for `attr.classes` ([List](#module-pandoc.list) of
1004+ strings)
9891005
9901006`attributes`
991−: alias for `attr.attributes` ([Attributes])
1007+: alias for `attr.attributes`
1008+ ([Attributes](#type-ref-Attributes))
9921009
9931010`tag`, `t`
9941011: the literal `Code` (string)
9951012
9961013### Emph {#type-ref-Emph}
1014+
9971015Emphasized text
9981016
9991017`content`
1000−: inline content ([List] of [Inline]s)
1018+: inline content ([List](#module-pandoc.list) of
1019+ [Inline](#type-ref-Inline)s)
10011020
10021021`tag`, `t`
10031022: the literal `Emph` (string)
10041023
10051024### Image {#type-ref-Image}
1006−Image: alt text (list of inlines), target
1025+
1026+Image: alt text (list of inlines), target
10071027
10081028`attr`
1009−: attributes ([Attr])
1029+: attributes ([Attr](#type-ref-Attr))
10101030
10111031`caption`
1012−: text used to describe the image ([List] of [Inline]s)
1032+: text used to describe the image ([List](#module-pandoc.list)
1033+ of [Inline](#type-ref-Inline)s)
10131034
10141035`src`
10151036: path to the image file (string)
@@ -1021,28 +1042,33 @@ Image: alt text (list of inlines), target
10211042: alias for `attr.identifier` (string)
10221043
10231044`classes`
1024−: alias for `attr.classes` ([List] of strings)
1045+: alias for `attr.classes` ([List](#module-pandoc.list) of
1046+ strings)
10251047
10261048`attributes`
1027−: alias for `attr.attributes` ([Attributes])
1049+: alias for `attr.attributes`
1050+ ([Attributes](#type-ref-Attributes))
10281051
10291052`tag`, `t`
10301053: the literal `Image` (string)
10311054
10321055### LineBreak {#type-ref-LineBreak}
1056+
10331057Hard line break
10341058
10351059`tag`, `t`
10361060: the literal `LineBreak` (string)
10371061
10381062### Link {#type-ref-Link}
1063+
10391064Hyperlink: alt text (list of inlines), target
10401065
10411066`attr`
1042−: attributes ([Attr])
1067+: attributes ([Attr](#type-ref-Attr))
10431068
10441069`content`
1045−: text for this link ([List] of [Inline]s)
1070+: text for this link ([List](#module-pandoc.list) of
1071+ [Inline](#type-ref-Inline)s)
10461072
10471073`target`
10481074: the link target (string)
@@ -1051,15 +1077,18 @@ Hyperlink: alt text (list of inlines), target
10511077: alias for `attr.identifier` (string)
10521078
10531079`classes`
1054−: alias for `attr.classes` ([List] of strings)
1080+: alias for `attr.classes` ([List](#module-pandoc.list) of
1081+ strings)
10551082
10561083`attributes`
1057−: alias for `attr.attributes` ([Attributes])
1084+: alias for `attr.attributes`
1085+ ([Attributes](#type-ref-Attributes))
10581086
10591087`tag`, `t`
10601088: the literal `Link` (string)
10611089
10621090### Math {#type-ref-Math}
1091+
10631092TeX math (literal)
10641093
10651094`mathtype`
@@ -1074,15 +1103,17 @@ TeX math (literal)
10741103: the literal `Math` (string)
10751104
10761105### Note {#type-ref-Note}
1106+
10771107Footnote or endnote
10781108
10791109`content`
1080−: ([List] of [Block]s)
1110+: ([List](#module-pandoc.list) of [Block](#type-ref-Block)s)
10811111
10821112`tag`, `t`
10831113: the literal `Note` (string)
10841114
10851115### Quoted {#type-ref-Quoted}
1116+
10861117Quoted text
10871118
10881119`quotetype`
@@ -1090,12 +1121,14 @@ Quoted text
10901121 `DoubleQuote` (string)
10911122
10921123`content`
1093−: quoted text ([List] of [Inline]s)
1124+: quoted text ([List](#module-pandoc.list) of
1125+ [Inline](#type-ref-Inline)s)
10941126
10951127`tag`, `t`
10961128: the literal `Quoted` (string)
10971129
10981130### RawInline {#type-ref-RawInline}
1131+
10991132Raw inline
11001133
11011134`format`
@@ -1108,48 +1141,56 @@ Raw inline
11081141: the literal `RawInline` (string)
11091142
11101143### SmallCaps {#type-ref-SmallCaps}
1144+
11111145Small caps text
11121146
11131147`content`
1114−: ([List] of [Inline]s)
1148+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
11151149
11161150`tag`, `t`
11171151: the literal `SmallCaps` (string)
11181152
11191153### SoftBreak {#type-ref-SoftBreak}
1154+
11201155Soft line break
11211156
11221157`tag`, `t`
11231158: the literal `SoftBreak` (string)
11241159
11251160### Space {#type-ref-Space}
1161+
11261162Inter-word space
11271163
11281164`tag`, `t`
11291165: the literal `Space` (string)
11301166
11311167### Span {#type-ref-Span}
1168+
11321169Generic inline container with attributes
11331170
11341171`attr`
1135−: attributes ([Attr])
1172+: attributes ([Attr](#type-ref-Attr))
11361173
11371174`content`
1138−: wrapped content ([List] of [Inline]s)
1175+: wrapped content ([List](#module-pandoc.list) of
1176+ [Inline](#type-ref-Inline)s)
11391177
11401178`identifier`
11411179: alias for `attr.identifier` (string)
11421180
11431181`classes`
1144−: alias for `attr.classes` ([List] of strings)
1182+: alias for `attr.classes` ([List](#module-pandoc.list) of
1183+ strings)
11451184
11461185`attributes`
1147−: alias for `attr.attributes` ([Attributes])
1186+: alias for `attr.attributes`
1187+ ([Attributes](#type-ref-Attributes))
11481188
11491189`tag`, `t`
11501190: the literal `Span` (string)
11511191
11521192### Str {#type-ref-Str}
1193+
11531194Text
11541195
11551196`text`
@@ -1159,37 +1200,45 @@ Text
11591200: the literal `Str` (string)
11601201
11611202### Strikeout {#type-ref-Strikeout}
1203+
11621204Strikeout text
11631205
11641206`content`
1165−: inline content ([List] of [Inline]s)
1207+: inline content ([List](#module-pandoc.list) of
1208+ [Inline](#type-ref-Inline)s)
11661209
11671210`tag`, `t`
11681211: the literal `Strikeout` (string)
11691212
11701213### Strong {#type-ref-Strong}
1214+
11711215Strongly emphasized text
11721216
11731217`content`
1174−: inline content ([List] of [Inline]s)
1218+: inline content ([List](#module-pandoc.list) of
1219+ [Inline](#type-ref-Inline)s)
11751220
11761221`tag`, `t`
11771222: the literal `Strong` (string)
11781223
11791224### Subscript {#type-ref-Subscript}
1225+
11801226Subscripted text
11811227
11821228`content`
1183−: inline content ([List] of [Inline]s)
1229+: inline content ([List](#module-pandoc.list) of
1230+ [Inline](#type-ref-Inline)s)
11841231
11851232`tag`, `t`
11861233: the literal `Subscript` (string)
11871234
11881235### Superscript {#type-ref-Superscript}
1236+
11891237Superscripted text
11901238
11911239`content`
1192−: inline content ([List] of [Inline]s)
1240+: inline content ([List](#module-pandoc.list) of
1241+ [Inline](#type-ref-Inline)s)
11931242
11941243`tag`, `t`
11951244: the literal `Superscript` (string)
@@ -1207,10 +1256,11 @@ Object equality is determined via
12071256: element identifier (string)
12081257
12091258`classes`
1210−: element classes ([List] of strings)
1259+: element classes ([List](#module-pandoc.list) of strings)
12111260
12121261`attributes`
1213−: collection of key/value pairs ([Attributes])
1262+: collection of key/value pairs
1263+ ([Attributes](#type-ref-Attributes))
12141264
12151265### Attributes {#type-ref-Attributes}
12161266
@@ -1232,10 +1282,12 @@ Object equality is determined via
12321282 `NormalCitation` (string)
12331283
12341284`prefix`
1235−: citation prefix ([List] of [Inline]s)
1285+: citation prefix ([List](#module-pandoc.list) of
1286+ [Inline](#type-ref-Inline)s)
12361287
12371288`suffix`
1238−: citation suffix ([List] of [Inline]s)
1289+: citation suffix ([List](#module-pandoc.list) of
1290+ [Inline](#type-ref-Inline)s)
12391291
12401292`note_num`
12411293: note number (integer)
@@ -1244,6 +1296,7 @@ Object equality is determined via
12441296: hash (integer)
12451297
12461298### ListAttributes {#type-ref-ListAttributes}
1299+
12471300List attributes
12481301
12491302Object equality is determined via
@@ -1253,19 +1306,19 @@ Object equality is determined via
12531306: number of the first list item (integer)
12541307
12551308`style`
1256−: style used for list numbers; possible values are `DefaultStyle`,
1257− `Example`, `Decimal`, `LowerRoman`, `UpperRoman`,
1258− `LowerAlpha`, and `UpperAlpha` (string)
1309+: style used for list numbers; possible values are
1310+ `DefaultStyle`, `Example`, `Decimal`, `LowerRoman`,
1311+ `UpperRoman`, `LowerAlpha`, and `UpperAlpha` (string)
12591312
12601313`delimiter`
12611314: delimiter of list numbers; one of `DefaultDelim`, `Period`,
12621315 `OneParen`, and `TwoParens` (string)
12631316
1264−
12651317## Hierarchical Element {#type-ref-Element}
12661318
12671319Hierarchical elements can be either *Sec* (sections) or *Blk*
1268−(blocks). *Blk* elements are treated like [Block]s.
1320+(blocks). *Blk* elements are treated like
1321+[Block](#type-ref-Block)s.
12691322
12701323### Sec {#type-ref-Sec}
12711324
@@ -1278,22 +1331,23 @@ document contents.
12781331: header level (integer)
12791332
12801333`numbering`
1281−: section numbering ([list] of integers)
1334+: section numbering ([list](#module-pandoc.list) of integers)
12821335
12831336`attr`
1284−: header attributes ([Attr])
1337+: header attributes ([Attr](#type-ref-Attr))
12851338
12861339`label`
1287−: header content ([list] of [Inline]s)
1340+: header content ([list](#module-pandoc.list) of
1341+ [Inline](#type-ref-Inline)s)
12881342
12891343`contents`
1290−: list of contents in this section ([list] of [hierarchical element]s)
1344+: list of contents in this section
1345+ ([list](#module-pandoc.list) of [hierarchical
1346+ element](#Element)s)
12911347
12921348`tag`, `t`
12931349: constant `Sec` (string)
12941350
1295−[hierarchical element]: #Element
1296−
12971351## ReaderOptions {#type-ref-ReaderOptions}
12981352
12991353Pandoc reader options
@@ -1323,7 +1377,7 @@ Pandoc reader options
13231377 (boolean)
13241378
13251379`tab_stop`
1326−: width (i.e. equivalent number of spaces) of tab stops
1380+: width (i.e. equivalent number of spaces) of tab stops
13271381 (integer)
13281382
13291383`track_changes`
@@ -1336,21 +1390,24 @@ The state used by pandoc to collect information and make it
13361390available to readers and writers.
13371391
13381392`input_files`
1339−: List of input files from command line ([List] of strings)
1393+: List of input files from command line
1394+ ([List](#module-pandoc.list) of strings)
13401395
13411396`output_file`
13421397: Output file from command line (string or nil)
13431398
13441399`log`
1345−: A list of log messages in reverse order ([List] of [LogMessage]s)
1400+: A list of log messages in reverse order
1401+ ([List](#module-pandoc.list) of
1402+ [LogMessage](#type-ref-LogMessage)s)
13461403
13471404`request_headers`
13481405: Headers to add for HTTP requests; table with header names as
13491406 keys and header contents as value (table)
13501407
13511408`resource_path`
1352−: Path to search for resources like included images ([List] of
1353− strings)
1409+: Path to search for resources like included images
1410+ ([List](#module-pandoc.list) of strings)
13541411
13551412`source_url`
13561413: Absolute URL or directory of first source file (string or
@@ -1367,8 +1424,8 @@ available to readers and writers.
13671424
13681425## LogMessage {#type-ref-LogMessage}
13691426
1370−A pandoc log message. Object have no fields, but can be converted
1371−to a string via `tostring`.
1427+A pandoc log message. Object have no fields, but can be
1428+converted to a string via `tostring`.
13721429
13731430## Version {#type-ref-Version}
13741431
@@ -1402,9 +1459,10 @@ Parameters:
14021459: minimum expected version ([Version](#type-ref-Version))
14031460
14041461`error_message`
1405−: optional error message template. The string is used as format
1406− string, with the expected and actual versions as arguments.
1407− Defaults to `"expected version %s or newer, got %s"`.
1462+: optional error message template. The string is used as
1463+ format string, with the expected and actual versions as
1464+ arguments. Defaults to
1465+ `"expected version %s or newer, got %s"`.
14081466
14091467Usage:
14101468
@@ -1414,16 +1472,6 @@ Usage:
14141472 'pandoc-types is too old: expected version %s, got %s'
14151473 )
14161474
1417−
1418−[Block]: #type-ref-Block
1419−[List]: #module-pandoc.list
1420−[MetaValue]: #type-ref-MetaValue
1421−[Inline]: #type-ref-Inline
1422−[Attr]: #type-ref-Attr
1423−[Attributes]: #type-ref-Attributes
1424−[citations]: #type-ref-Citation
1425−[LogMessage]: #type-ref-LogMessage
1426−
14271475# Module text
14281476
14291477UTF-8 aware text manipulation functions, implemented in Haskell.
@@ -1476,714 +1524,732 @@ Lua functions for pandoc scripts.
14761524
14771525## Pandoc Document
14781526
1479−### Pandoc {#Pandoc}
1527+[`Pandoc (blocks[, meta])`]{#Pandoc}
14801528
1481−`Pandoc (blocks[, meta])`
1529+: A complete pandoc document
14821530
1483−A complete pandoc document
1531+ Parameters:
14841532
1485−Parameters:
1533+ `blocks`:
1534+ : document content
14861535
1487−`blocks`:
1488−: list of [Blocks]
1536+ `meta`:
1537+ : document meta data
14891538
1490−`meta`:
1491−: [Meta] value (see below)
1539+## Meta {#meta}
14921540
1493−## Metadata
1541+[`Meta (table)`]{#Meta}
14941542
1495−### Meta {#Meta}
1543+: Create a new Meta object.
14961544
1497−`Meta (table)`
1545+ Parameters:
14981546
1499−Create a new [Meta] object.
1547+ `table`:
1548+ : table containing document meta information
15001549
1501−Parameters:
1550+## MetaValue {#metavalue}
15021551
1503−`table`:
1504−: table with string keys and [MetaValue] values
1552+[`MetaBlocks (blocks)`]{#MetaBlocks}
15051553
1506−## MetaValue
1554+: Meta blocks
15071555
1508−### MetaBlocks {#MetaBlocks}
1556+ Parameters:
15091557
1510−`MetaBlocks (blocks)`
1558+ `blocks`:
1559+ : blocks
15111560
1512−Block-level metadata content.
1561+[`MetaInlines (inlines)`]{#MetaInlines}
15131562
1514−Parameters:
1563+: Meta inlines
15151564
1516−`blocks`:
1517−: list of [Blocks]
1565+ Parameters:
15181566
1519−### MetaInlines {#MetaInlines}
1567+ `inlines`:
1568+ : inlines
15201569
1521−`MetaInlines (inlines)`
1570+[`MetaList (meta_values)`]{#MetaList}
15221571
1523−Inline-level metadata content.
1572+: Meta list
15241573
1525−Parameters:
1574+ Parameters:
15261575
1527−`inlines`:
1528−: list of [Inlines]
1576+ `meta_values`:
1577+ : list of meta values
15291578
1530−### MetaList {#MetaList}
1579+[`MetaMap (key_value_map)`]{#MetaMap}
15311580
1532−`MetaList (meta_values)`
1581+: Meta map
15331582
1534−List of metadata items.
1583+ Parameters:
15351584
1536−Parameters:
1585+ `key_value_map`:
1586+ : a string-indexed map of meta values
15371587
1538−`meta_values`:
1539−: list of [MetaValues][MetaValue]
1588+[`MetaString (str)`]{#MetaString}
15401589
1541−### MetaMap {#MetaMap}
1590+: Creates string to be used in meta data.
15421591
1543−`MetaMap (key_value_map)`
1592+ Parameters:
15441593
1545−Field/value map of metadata items.
1594+ `str`:
1595+ : string value
15461596
1547−Parameters:
1597+[`MetaBool (bool)`]{#MetaBool}
15481598
1549−`key_value_map`:
1550−: a table with string keys and [MetaValue] values
1599+: Creates boolean to be used in meta data.
15511600
1552−### MetaString {#MetaString}
1601+ Parameters:
15531602
1554−`MetaString (str)`
1603+ `bool`:
1604+ : boolean value
15551605
1556−String metadata content.
1606+## Blocks
15571607
1558−Parameters:
1608+[`Block`]{#Block}
15591609
1560−`str`:
1561−: string value
1610+: Block elements
15621611
1563−### MetaBool {#MetaBool}
1612+[`BlockQuote (content)`]{#BlockQuote}
15641613
1565−`MetaBool (bool)`
1614+: Creates a block quote element
15661615
1567−Boolean metadata content.
1616+ Parameters:
15681617
1569−Parameters:
1618+ `content`:
1619+ : block content
15701620
1571−`bool`:
1572−: boolean value
1621+ Returns: block quote element
15731622
1574−## Blocks {#Blocks}
1623+[`BulletList (content)`]{#BulletList}
15751624
1576−### BlockQuote {#BlockQuote}
1625+: Creates a bullet (i.e.
15771626
1578−`BlockQuote (content)`
1627+ Parameters:
15791628
1580−Creates a BlockQuote element
1629+ `content`:
1630+ : list of items
15811631
1582−Parameters:
1632+ Returns: bullet list element
15831633
1584−`content`:
1585−: list of [Blocks]
1634+[`CodeBlock (text[, attr])`]{#CodeBlock}
15861635
1587−Returns: BlockQuote element
1636+: Creates a code block element
15881637
1589−### BulletList {#BulletList}
1638+ Parameters:
15901639
1591−`BulletList (content)`
1640+ `text`:
1641+ : code string
15921642
1593−Creates a BulletList element
1643+ `attr`:
1644+ : element attributes
15941645
1595−Parameters:
1646+ Returns: code block element
15961647
1597−`content`:
1598−: list of items (where each item is a list of [Blocks])
1648+[`DefinitionList (content)`]{#DefinitionList}
15991649
1600−Returns: BulletList element
1650+: Creates a definition list, containing terms and their
1651+ explanation.
16011652
1602−### CodeBlock {#CodeBlock}
1653+ Parameters:
16031654
1604−`CodeBlock (text[, attr])`
1655+ `content`:
1656+ : list of items
16051657
1606−Creates a CodeBlock element
1658+ Returns: definition list element
16071659
1608−Parameters:
1660+[`Div (content[, attr])`]{#Div}
16091661
1610−`text`:
1611−: string (the code)
1662+: Creates a div element
16121663
1613−`attr`:
1614−: [Attr](#Attr) (code attributes)
1664+ Parameters:
16151665
1616−Returns: CodeBlock element
1666+ `content`:
1667+ : block content
16171668
1618−### DefinitionList {#DefinitionList}
1669+ `attr`:
1670+ : element attributes
16191671
1620−`DefinitionList (content)`
1672+ Returns: div element
16211673
1622−Creates a DefinitionList element
1674+[`Header (level, content[, attr])`]{#Header}
16231675
1624−Parameters:
1676+: Creates a header element.
16251677
1626−`content`:
1627−: list of items (where each item is a two element list,
1628− where the first element is a list of [Inlines], the
1629− term, and the second is a list of lists of [Blocks],
1630− the definitions)
1678+ Parameters:
16311679
1632−Returns: DefinitionList element
1680+ `level`:
1681+ : header level
16331682
1634−### Div {#Div}
1683+ `content`:
1684+ : inline content
16351685
1636−`Div (content[, attr])`
1686+ `attr`:
1687+ : element attributes
16371688
1638−Creates a Div element
1689+ Returns: header element
16391690
1640−Parameters:
1691+[`HorizontalRule ()`]{#HorizontalRule}
16411692
1642−`content`:
1643−: list of [Blocks]
1693+: Creates a horizontal rule.
16441694
1645−`attr`:
1646−: [Attr](#Attr) (Div attributes)
1695+ Returns: horizontal rule
16471696
1648−Returns: Div element
1697+[`LineBlock (content)`]{#LineBlock}
16491698
1650−### Header {#Header}
1699+: Creates a line block element.
16511700
1652−`Header (level, content[, attr])`
1701+ Parameters:
16531702
1654−Creates a Header element.
1703+ `content`:
1704+ : inline content
16551705
1656−Parameters:
1706+ Returns: line block element
16571707
1658−`level`:
1659−: Header level (integer)
1708+[`Null ()`]{#Null}
16601709
1661−`content`:
1662−: list of [Inlines] (header title)
1710+: Creates a null element.
16631711
1664−`attr`:
1665−: [Attr](#Attr) (header attributes)
1712+ Returns: null element
16661713
1667−Returns: Header element
1714+[`OrderedList (items[, listAttributes])`]{#OrderedList}
16681715
1669−### HorizontalRule {#HorizontalRule}
1716+: Creates an ordered list.
16701717
1671−`HorizontalRule ()`
1718+ Parameters:
16721719
1673−Creates a HorizontalRule element.
1720+ `items`:
1721+ : list items
16741722
1675−Returns: HorizontalRule element
1723+ `listAttributes`:
1724+ : list parameters
16761725
1677−### LineBlock {#LineBlock}
1726+ Returns: ordered list element
16781727
1679−`LineBlock (content)`
1728+[`Para (content)`]{#Para}
16801729
1681−Creates a LineBlock element.
1730+: Creates a para element.
16821731
1683−Parameters:
1732+ Parameters:
16841733
1685−`content`:
1686−: list of lines (where each line is a list of [Inlines])
1734+ `content`:
1735+ : inline content
16871736
1688−Returns: LineBlock element
1737+ Returns: paragraph element
16891738
1690−### Null {#Null}
1739+[`Plain (content)`]{#Plain}
16911740
1692−`Null ()`
1741+: Creates a plain element.
16931742
1694−Creates a Null block element.
1743+ Parameters:
16951744
1696−Returns: Null element
1745+ `content`:
1746+ : inline content
16971747
1698−### OrderedList {#OrderedList}
1748+ Returns: plain element
16991749
1700−`OrderedList (items[, listAttributes])`
1750+[`RawBlock (format, text)`]{#RawBlock}
17011751
1702−Creates an OrderedList element.
1752+: Creates a raw content block of the specified format.
17031753
1704−Parameters:
1754+ Parameters:
17051755
1706−`items`:
1707−: list of items (where each item is a list of [Blocks])
1756+ `format`:
1757+ : format of content
17081758
1709−`listAttributes`:
1710−: [ListAttributes]{#ListAttributes}
1759+ `text`:
1760+ : string content
17111761
1712−Returns: OrderedList element
1762+ Returns: raw block element
17131763
1714−### Para {#Para}
1764+[`Table (caption, aligns, widths, headers, rows)`]{#Table}
17151765
1716−`Para (content)`
1766+: Creates a table element.
17171767
1718−Creates a Para element.
1768+ Parameters:
17191769
1720−Parameters:
1770+ `caption`:
1771+ : table caption
17211772
1722−`content`:
1723−: list of [Inlines]
1773+ `aligns`:
1774+ : alignments
17241775
1725−Returns: Para element
1776+ `widths`:
1777+ : column widths
17261778
1727−### Plain {#Plain}
1779+ `headers`:
1780+ : header row
17281781
1729−`Plain (content)`
1782+ `rows`:
1783+ : table rows
17301784
1731−Creates a Plain element.
1785+ Returns: table element
17321786
1733−Parameters:
1787+## Inline {#inline}
17341788
1735−`content`:
1736−: list of [Inlines]
1789+[`Inline`]{#Inline}
17371790
1738−Returns: Plain element
1791+: Inline element class
17391792
1740−### RawBlock {#RawBlock}
1793+[`Cite (content, citations)`]{#Cite}
17411794
1742−`RawBlock (format, text)`
1795+: Creates a Cite inline element
17431796
1744−Creates a RawBlock of the specified format.
1797+ Parameters:
17451798
1746−Parameters:
1799+ `content`:
1800+ : List of inlines
17471801
1748−`format`:
1749−: string (format of content, e.g. 'latex')
1802+ `citations`:
1803+ : List of citations
17501804
1751−`text`:
1752−: string content
1805+ Returns: citations element
17531806
1754−Returns: RawBlock element
1807+[`Code (text[, attr])`]{#Code}
17551808
1756−### Table {#Table}
1809+: Creates a Code inline element
17571810
1758−`Table (caption, aligns, widths, headers, rows)`
1811+ Parameters:
17591812
1760−Creates a Table element.
1813+ `text`:
1814+ : code string
17611815
1762−Parameters:
1816+ `attr`:
1817+ : additional attributes
17631818
1764−`caption`:
1765−: table caption (list of [Inlines])
1819+ Returns: code element
17661820
1767−`aligns`:
1768−: alignments (a list of
1769− `pandoc.AlignDefault`, `pandoc.AlignLeft`, `pandoc.AlignRight`,
1770− `pandoc.AlignCenter`, one for each column)
1821+[`Emph (content)`]{#Emph}
17711822
1772−`widths`:
1773−: column widths (a list of floats, one for each column,
1774− denoting the fraction of the textwidth needed for the
1775− column, 0.5 = half width; OR an empty list for a
1776− simple table where cells need not wrap)
1823+: Creates an inline element representing emphasised text.
17771824
1778−`headers`:
1779−: header row (a list of cells, each cell a list of [Blocks])
1825+ Parameters:
17801826
1781−`rows`:
1782−: table rows (a list of rows, each row a list of cells,
1783− each cell a list of [Blocks])
1827+ `content`:
1828+ : inline content
17841829
1785−Returns: Table element
1830+ Returns: emphasis element
17861831
1787−## Inlines {#Inlines}
1832+[`Image (caption, src[, title[, attr]])`]{#Image}
17881833
1789−### Cite {#Cite}
1834+: Creates a Image inline element
17901835
1791−`Cite (content, citations)`
1836+ Parameters:
17921837
1793−Creates a Cite element
1838+ `caption`:
1839+ : text used to describe the image
17941840
1795−Parameters:
1841+ `src`:
1842+ : path to the image file
17961843
1797−`content`:
1798−: list of [Inlines]
1844+ `title`:
1845+ : brief image description
17991846
1800−`citations`:
1801−: list of [Citation]s
1847+ `attr`:
1848+ : additional attributes
18021849
1803−Returns: citations element
1850+ Returns: image element
18041851
1805−### Code {#Code}
1852+[`LineBreak ()`]{#LineBreak}
18061853
1807−`Code (text[, attr])`
1854+: Create a LineBreak inline element
18081855
1809−Creates a Code inline element
1856+ Returns: linebreak element
18101857
1811−Parameters:
1858+[`Link (content, target[, title[, attr]])`]{#Link}
18121859
1813−`text`:
1814−: string (the code)
1860+: Creates a link inline element, usually a hyperlink.
18151861
1816−`attr`:
1817−: [Attr](#Attr) (code attributes)
1862+ Parameters:
18181863
1819−Returns: Code element
1864+ `content`:
1865+ : text for this link
18201866
1821−### Emph {#Emph}
1867+ `target`:
1868+ : the link target
18221869
1823−`Emph (content)`
1870+ `title`:
1871+ : brief link description
18241872
1825−Creates an Emph inline element
1873+ `attr`:
1874+ : additional attributes
18261875
1827−Parameters:
1876+ Returns: image element
18281877
1829−`content`:
1830−: list of [Inlines]
1878+[`Math (mathtype, text)`]{#Math}
18311879
1832−Returns: Emph element
1880+: Creates a Math element, either inline or displayed.
18331881
1834−### Image {#Image}
1882+ Parameters:
18351883
1836−`Image (alt, src[, title[, attr]])`
1884+ `mathtype`:
1885+ : rendering specifier
18371886
1838−Creates a Image inline element
1887+ `text`:
1888+ : Math content
18391889
1840−Parameters:
1890+ Returns: Math element
18411891
1842−`alt`:
1843−: list of [Inlines]: alt text (or, for implicit figures,
1844− caption)
1892+[`DisplayMath (text)`]{#DisplayMath}
18451893
1846−`src`:
1847−: string: path to the image file
1894+: Creates a DisplayMath element (DEPRECATED).
18481895
1849−`title`:
1850−: string: title attribute
1896+ Parameters:
18511897
1852−`attr`:
1853−: [Attr](#Attr): additional image attributes
1898+ `text`:
1899+ : Math content
18541900
1855−Returns: Image element
1901+ Returns: Math element
18561902
1857−### LineBreak {#LineBreak}
1903+[`InlineMath (text)`]{#InlineMath}
18581904
1859−`LineBreak ()`
1905+: Creates an InlineMath inline element (DEPRECATED).
18601906
1861−Create a LineBreak inline element
1907+ Parameters:
18621908
1863−Returns: linebreak element
1909+ `text`:
1910+ : Math content
18641911
1865−### Link {#Link}
1912+ Returns: Math element
18661913
1867−`Link (content, target[, title[, attr]])`
1914+[`Note (content)`]{#Note}
18681915
1869−Creates a Link inline element
1916+: Creates a Note inline element
18701917
1871−Parameters:
1918+ Parameters:
18721919
1873−`content`:
1874−: list of [Inlines]: the linked text
1920+ `content`:
1921+ : footnote block content
18751922
1876−`target`:
1877−: string: the link target
1923+[`Quoted (quotetype, content)`]{#Quoted}
18781924
1879−`title`:
1880−: string: the title attribute
1925+: Creates a Quoted inline element given the quote type and
1926+ quoted content.
18811927
1882−`attr`:
1883−: [Attr](#Attr): additional link attributes
1928+ Parameters:
18841929
1885−Returns: image element
1930+ `quotetype`:
1931+ : type of quotes to be used
18861932
1887−### Math {#Math}
1933+ `content`:
1934+ : inline content
18881935
1889−`Math (mathtype, text)`
1936+ Returns: quoted element
18901937
1891−Creates a Math inline element, either inline or displayed.
1938+[`SingleQuoted (content)`]{#SingleQuoted}
18921939
1893−Parameters:
1940+: Creates a single-quoted inline element (DEPRECATED).
18941941
1895−`mathtype`:
1896−: either `pandoc.InlineMath` or `pandoc.DisplayMath`
1942+ Parameters:
18971943
1898−`text`:
1899−: string: raw tex math
1944+ `content`:
1945+ : inline content
19001946
1901−Returns: Math element
1947+ Returns: quoted element
19021948
1903−### DisplayMath {#DisplayMath}
1949+ See also: [Quoted](#Quoted)
19041950
1905−`DisplayMath (text)`
1951+[`DoubleQuoted (content)`]{#DoubleQuoted}
19061952
1907−Creates a DisplayMath element (DEPRECATED, use `Math`).
1953+: Creates a single-quoted inline element (DEPRECATED).
19081954
1909−Parameters:
1955+ Parameters:
19101956
1911−`text`:
1912−: string: raw tex math
1957+ `content`:
1958+ : inline content
19131959
1914−Returns: Math element
1960+ Returns: quoted element
19151961
1916−### InlineMath {#InlineMath}
1962+ See also: [Quoted](#Quoted)
19171963
1918−`InlineMath (text)`
1964+[`RawInline (format, text)`]{#RawInline}
19191965
1920−Creates an InlineMath inline element (DEPRECATED, use
1921−[Math]{#Math}).
1966+: Creates a RawInline inline element
19221967
1923−Parameters:
1968+ Parameters:
19241969
1925−`text`:
1926−: string: raw tex math
1970+ `format`:
1971+ : format of the contents
19271972
1928−Returns: Math element
1973+ `text`:
1974+ : string content
19291975
1930−### Note {#Note}
1976+ Returns: raw inline element
19311977
1932−`Note (content)`
1978+[`SmallCaps (content)`]{#SmallCaps}
19331979
1934−Creates a Note inline element
1980+: Creates text rendered in small caps
19351981
1936−Parameters:
1982+ Parameters:
19371983
1938−`content`:
1939−: list of [Blocks] (content of footnote)
1984+ `content`:
1985+ : inline content
19401986
1941−### Quoted {#Quoted}
1987+ Returns: smallcaps element
19421988
1943−`Quoted (quotetype, content)`
1989+[`SoftBreak ()`]{#SoftBreak}
19441990
1945−Creates a Quoted inline element
1991+: Creates a SoftBreak inline element.
19461992
1947−Parameters:
1993+ Returns: softbreak element
19481994
1949−`quotetype`:
1950−: either `pandoc.DoubleQuote` or `pandoc.SingleQuote`
1995+[`Space ()`]{#Space}
19511996
1952−`content`:
1953−: list of [Inlines]
1997+: Create a Space inline element
19541998
1955−Returns: Quoted element
1999+ Returns: space element
19562000
1957−### SingleQuoted {#SingleQuoted}
2001+[`Span (content[, attr])`]{#Span}
19582002
1959−`SingleQuoted (content)`
2003+: Creates a Span inline element
19602004
1961−Creates a single-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2005+ Parameters:
19622006
1963−Parameters:
2007+ `content`:
2008+ : inline content
19642009
1965−`content`:
1966−: list of [Inlines]
2010+ `attr`:
2011+ : additional attributes
19672012
1968−Returns: Quoted element
2013+ Returns: span element
19692014
1970−### DoubleQuoted {#DoubleQuoted}
2015+[`Str (text)`]{#Str}
19712016
1972−`DoubleQuoted (content)`
2017+: Creates a Str inline element
19732018
1974−Creates a double-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2019+ Parameters:
19752020
1976−Parameters:
2021+ `text`:
2022+ : content
19772023
1978−`content`:
1979−: list of [Inlines]
2024+ Returns: string element
19802025
1981−Returns: Quoted element
2026+[`Strikeout (content)`]{#Strikeout}
19822027
1983−### RawInline {#RawInline}
2028+: Creates text which is striked out.
19842029
1985−`RawInline (format, text)`
2030+ Parameters:
19862031
1987−Creates a RawInline inline element
2032+ `content`:
2033+ : inline content
19882034
1989−Parameters:
2035+ Returns: strikeout element
19902036
1991−`format`:
1992−: string (format of the contents)
2037+[`Strong (content)`]{#Strong}
19932038
1994−`text`:
1995−: string (content)
2039+: Creates a Strong element, whose text is usually displayed in
2040+ a bold font.
19962041
1997−Returns: RawInline element
2042+ Parameters:
19982043
1999−### Smallcaps {#SmallCaps}
2044+ `content`:
2045+ : inline content
20002046
2001−`SmallCaps (content)`
2047+ Returns: strong element
20022048
2003−Creates text rendered in small caps
2049+[`Subscript (content)`]{#Subscript}
20042050
2005−Parameters:
2051+: Creates a Subscript inline element
20062052
2007−`content`:
2008−: list of [Inlines]
2053+ Parameters:
20092054
2010−Returns: SmallCaps element
2055+ `content`:
2056+ : inline content
20112057
2012−### SoftBreak {#SoftBreak}
2058+ Returns: subscript element
20132059
2014−`SoftBreak ()`
2060+[`Superscript (content)`]{#Superscript}
20152061
2016−Creates a SoftBreak inline element.
2062+: Creates a Superscript inline element
20172063
2018−Returns: SoftBreak element
2064+ Parameters:
20192065
2020−### Space {#Space}
2066+ `content`:
2067+ : inline content
20212068
2022−`Space ()`
2069+ Returns: strong element
20232070
2024−Create a Space inline element
2071+## Element components {#element-components}
20252072
2026−Returns: Space element
2073+[`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
20272074
2028−### Span {#Span}
2075+: Create a new set of attributes (Attr).
20292076
2030−`Span (content[, attr])`
2077+ Parameters:
20312078
2032−Creates a Span inline element
2079+ `identifier`:
2080+ : element identifier
20332081
2034−Parameters:
2082+ `classes`:
2083+ : element classes
20352084
2036−`content`:
2037−: list of [Inlines]
2085+ `attributes`:
2086+ : table containing string keys and values
20382087
2039−`attr`:
2040−: [Attr](#Attr): span attributes
2088+ Returns: element attributes
20412089
2042−Returns: Span element
2090+[`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`]{#Citation}
20432091
2044−### Str {#Str}
2092+: Creates a single citation.
20452093
2046−`Str (text)`
2094+ Parameters:
20472095
2048−Creates a Str inline element
2096+ `id`:
2097+ : citation identifier (like a bibtex key)
20492098
2050−Parameters:
2099+ `mode`:
2100+ : citation mode
20512101
2052−`text`:
2053−: string
2102+ `prefix`:
2103+ : citation prefix
20542104
2055−Returns: String element
2105+ `suffix`:
2106+ : citation suffix
20562107
2057−### Strikeout {#Strikeout}
2108+ `note_num`:
2109+ : note number
20582110
2059−`Strikeout (content)`
2111+ `hash`:
2112+ : hash number
20602113
2061−Creates a Strikeout inline element
2114+[`ListAttributes ([start[, style[, delimiter]]])`]{#ListAttributes}
20622115
2063−Parameters:
2116+: Creates a set of list attributes.
20642117
2065−`content`:
2066−: list of [Inlines]
2118+ Parameters:
20672119
2068−Returns: Strikeout element
2120+ `start`:
2121+ : number of the first list item
20692122
2070−### Strong {#Strong}
2123+ `style`:
2124+ : style used for list numbering
20712125
2072−`Strong (content)`
2126+ `delimiter`:
2127+ : delimiter of list numbers
20732128
2074−Creates a Strong inline element.
2129+ Returns: list attributes table
20752130
2076−Parameters:
2131+## Constants
20772132
2078−`content`:
2079−: list of [Inlines]
2133+[`AuthorInText`]{#AuthorInText}
20802134
2081−Returns: Strong element
2135+: Author name is mentioned in the text.
20822136
2083−### Subscript {#Subscript}
2137+ See also: [Citation](#Citation)
20842138
2085−`Subscript (content)`
2139+[`SuppressAuthor`]{#SuppressAuthor}
20862140
2087−Creates a Subscript inline element
2141+: Author name is suppressed.
20882142
2089−Parameters:
2143+ See also: [Citation](#Citation)
20902144
2091−`content`:
2092−: list of [Inlines]
2145+[`NormalCitation`]{#NormalCitation}
20932146
2094−Returns: Subscript element
2147+: Default citation style is used.
20952148
2096−### Superscript {#Superscript}
2149+ See also: [Citation](#Citation)
20972150
2098−`Superscript (content)`
2151+[`AlignLeft`]{#AlignLeft}
20992152
2100−Creates a Superscript inline element
2153+: Table cells aligned left.
21012154
2102−Parameters:
2155+ See also: [Table](#Table)
21032156
2104−`content`:
2105−: list of [Inlines]
2157+[`AlignRight`]{#AlignRight}
21062158
2107−Returns: Superscript element
2159+: Table cells right-aligned.
21082160
2109−## Element components
2161+ See also: [Table](#Table)
21102162
2111−### Attr {#Attr}
2163+[`AlignCenter`]{#AlignCenter}
21122164
2113−`Attr ([identifier[, classes[, attributes]]])`
2165+: Table cell content is centered.
21142166
2115−Create a new set of attributes (Attr).
2167+ See also: [Table](#Table)
21162168
2117−Parameters:
2169+[`AlignDefault`]{#AlignDefault}
21182170
2119−`identifier`:
2120−: string: element identifier
2171+: Table cells are alignment is unaltered.
21212172
2122−`classes`:
2123−: list of strings: classes
2173+ See also: [Table](#Table)
21242174
2125−`attributes`:
2126−: table containing string keys and values
2175+[`DefaultDelim`]{#DefaultDelim}
21272176
2128−Returns: Attr
2177+: Default list number delimiters are used.
21292178
2130−### Citation {#Citation}
2179+ See also: [OrderedList](#OrderedList)
21312180
2132−`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`
2181+[`Period`]{#Period}
21332182
2134−Creates a single Citation.
2183+: List numbers are delimited by a period.
21352184
2136−Parameters:
2185+ See also: [OrderedList](#OrderedList)
21372186
2138−`id`:
2139−: string citation identifier (like a bibtex key)
2187+[`OneParen`]{#OneParen}
21402188
2141−`mode`:
2142−: `pandoc.AuthorInText`, `pandoc.SuppressAuthor`, or
2143− `pandoc.NormalCitation`
2189+: List numbers are delimited by a single parenthesis.
21442190
2145−`prefix`:
2146−: list of [Inlines] for citation prefix
2191+ See also: [OrderedList](#OrderedList)
21472192
2148−`suffix`:
2149−: list of [Inlines] for citation suffix
2193+[`TwoParens`]{#TwoParens}
21502194
2151−`note_num`:
2152−: int: note number
2195+: List numbers are delimited by a double parentheses.
21532196
2154−`hash`:
2155−: int: hash number
2197+ See also: [OrderedList](#OrderedList)
21562198
2157−### ListAttributes {#ListAttributes}
2199+[`DefaultStyle`]{#DefaultStyle}
21582200
2159−`ListAttributes ([start[, style[, delimiter]]])`
2201+: List are numbered in the default style
21602202
2161−Creates a set of list attributes
2203+ See also: [OrderedList](#OrderedList)
21622204
2163−Parameters:
2205+[`Example`]{#Example}
2206+
2207+: List items are numbered as examples.
2208+
2209+ See also: [OrderedList](#OrderedList)
2210+
2211+[`Decimal`]{#Decimal}
2212+
2213+: List are numbered using decimal integers.
2214+
2215+ See also: [OrderedList](#OrderedList)
2216+
2217+[`LowerRoman`]{#LowerRoman}
21642218
2165−`start`:
2166−: int: number of the first list item (default: 1)
2219+: List are numbered using lower-case roman numerals.
21672220
2168−`style`:
2169−: `pandoc.DefaultStyle` (default), `pandoc.Decimal`,
2170− `pandoc.LowerRoman`, `pandoc.UpperRoman`, `pandoc.LowerAlpha`,
2171− or `pandoc.UpperAlpha`
2221+ See also: [OrderedList](#OrderedList)
21722222
2173−`delimiter`:
2174−: `pandoc.DefaultDelim` (default), `pandoc.Period`,
2175− `pandoc.OneParen`, `pandoc.TwoParens`
2223+[`UpperRoman`]{#UpperRoman}
21762224
2177−Returns: list attributes table
2225+: List are numbered using upper-case roman numerals
2226+
2227+ See also: [OrderedList](#OrderedList)
2228+
2229+[`LowerAlpha`]{#LowerAlpha}
2230+
2231+: List are numbered using lower-case alphabetic characters.
2232+
2233+ See also: [OrderedList](#OrderedList)
2234+
2235+[`UpperAlpha`]{#UpperAlpha}
2236+
2237+: List are numbered using upper-case alphabetic characters.
2238+
2239+ See also: [OrderedList](#OrderedList)
2240+
2241+[`sha1`]{#sha1}
2242+
2243+: Functions which have moved to different modules
21782244
21792245## Helper functions
21802246
2181−### pipe {#pipe}
2247+### pipe
21822248
21832249`pipe (command, args, input)`
21842250
2185−Runs command with arguments, passing it some input, and
2186−returns the output.
2251+Runs command with arguments, passing it some input, and returns
2252+the output.
21872253
21882254Returns:
21892255
@@ -2199,7 +2265,7 @@ Usage:
21992265
22002266 local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
22012267
2202−### walk_block {#walk_block}
2268+### walk\_block
22032269
22042270`walk_block (element, filter)`
22052271
@@ -2211,17 +2277,16 @@ Parameters:
22112277: the block element
22122278
22132279`filter`:
2214−: a lua filter (table of functions) to be applied within
2215− the block element
2280+: a lua filter (table of functions) to be applied within the
2281+ block element
22162282
22172283Returns: the transformed block element
22182284
2219−### walk_inline {#walk_inline}
2285+### walk\_inline
22202286
22212287`walk_inline (element, filter)`
22222288
2223−Apply a filter inside an inline element, walking its
2224−contents.
2289+Apply a filter inside an inline element, walking its contents.
22252290
22262291Parameters:
22272292
@@ -2229,12 +2294,12 @@ Parameters:
22292294: the inline element
22302295
22312296`filter`:
2232−: a lua filter (table of functions) to be applied within
2233− the inline element
2297+: a lua filter (table of functions) to be applied within the
2298+ inline element
22342299
22352300Returns: the transformed inline element
22362301
2237−### read {#read}
2302+### read
22382303
22392304`read (markup[, format])`
22402305
@@ -2259,15 +2324,14 @@ Usage:
22592324 -- The inline element in that block is an `Emph`
22602325 assert(block.content[1].t == "Emph")
22612326
2262−
22632327# Module pandoc.utils
22642328
22652329This module exposes internal pandoc functions and utility
22662330functions.
22672331
2268−The module is loaded as part of the `pandoc` module and available
2269−as `pandoc.utils`. In versions up-to and including pandoc 2.6,
2270−this module had to be loaded explicitly. Example:
2332+The module is loaded as part of the `pandoc` module and
2333+available as `pandoc.utils`. In versions up-to and including
2334+pandoc 2.6, this module had to be loaded explicitly. Example:
22712335
22722336 local utils = require 'pandoc.utils'
22732337
@@ -2282,16 +2346,16 @@ Squash a list of blocks into a list of inlines.
22822346Parameters:
22832347
22842348`blocks`:
2285−: List of [Blocks] to be flattened.
2349+: List of [Blocks](#Blocks) to be flattened.
22862350
22872351`sep`:
2288−: List of [Inlines] inserted as separator between two
2289− consecutive blocks; defaults to `{ pandoc.Space(),
2290− pandoc.Str'¶', pandoc.Space()}`.
2352+: List of [Inlines](#Inlines) inserted as separator between
2353+ two consecutive blocks; defaults to
2354+ `{ pandoc.Space(), pandoc.Str'¶', pandoc.Space()}`.
22912355
22922356Returns:
22932357
2294−- List of [Inlines]
2358+- List of [Inlines](#Inlines)
22952359
22962360Usage:
22972361
@@ -2319,30 +2383,26 @@ Parameters:
23192383`element1`, `element2`:
23202384: Objects to be compared. Acceptable input types are
23212385 [Pandoc](#type-ref-pandoc), [Meta](#type-ref-meta),
2322− [MetaValue](#type-ref-MetaValue),
2323− [Block](#type-ref-Block), [Inline](#type-ref-Inline),
2324− [Attr](#type-ref-Attr),
2386+ [MetaValue](#type-ref-MetaValue), [Block](#type-ref-Block),
2387+ [Inline](#type-ref-Inline), [Attr](#type-ref-Attr),
23252388 [ListAttributes](#type-ref-ListAttributes), and
23262389 [Citation](#type-ref-Citation).
23272390
23282391Returns:
23292392
2330−- Whether the two objects represent the same element
2331− (boolean)
2393+- Whether the two objects represent the same element (boolean)
23322394
23332395### hierarchicalize {#utils-hierarchicalize}
23342396
23352397`hierarchicalize (blocks)`
23362398
2337−Convert list of [Blocks] into an hierarchical list. An
2338−hierarchical elements is either a normal block (but no
2339−Header), or a `Sec` element. The latter has the following
2340−fields:
2399+Convert list of [Blocks](#Blocks) into an hierarchical list. An
2400+hierarchical elements is either a normal block (but no Header),
2401+or a `Sec` element. The latter has the following fields:
23412402
23422403- level: level in the document hierarchy;
2343−- numbering: list of integers of length `level`,
2344− specifying the absolute position of the section in the
2345− document;
2404+- numbering: list of integers of length `level`, specifying
2405+ the absolute position of the section in the document;
23462406- attr: section attributes (see [Attr](#Attr));
23472407- contents: nested list of hierarchical elements.
23482408
@@ -2393,14 +2453,14 @@ Usage:
23932453 )
23942454 some_blocks = sub_doc.blocks -- some blocks with bib
23952455
2396−### normalize_date {#utils-normalize_date}
2456+### normalize\_date {#utils-normalize_date}
23972457
23982458`normalize_date (date_string)`
23992459
2400−Parse a date and convert (if possible) to "YYYY-MM-DD"
2401−format. We limit years to the range 1601-9999 (ISO 8601
2402−accepts greater than or equal to 1583, but MS Word only
2403−accepts dates starting 1601).
2460+Parse a date and convert (if possible) to "YYYY-MM-DD" format.
2461+We limit years to the range 1601-9999 (ISO 8601 accepts greater
2462+than or equal to 1583, but MS Word only accepts dates starting
2463+1601).
24042464
24052465Returns:
24062466
@@ -2424,8 +2484,8 @@ Usage:
24242484
24252485`stringify (element)`
24262486
2427−Converts the given element (Pandoc, Meta, Block, or Inline)
2428−into a string with all formatting removed.
2487+Converts the given element (Pandoc, Meta, Block, or Inline) into
2488+a string with all formatting removed.
24292489
24302490Returns:
24312491
@@ -2459,9 +2519,9 @@ The `pandoc.mediabag` module allows accessing pandoc's media
24592519storage. The "media bag" is used when pandoc is called with the
24602520`--extract-media` or `--standalone`/`-s` option.
24612521
2462−The module is loaded as part of module `pandoc` and can either be
2463−accessed via the `pandoc.mediabag` field, or explicitly required,
2464−e.g.:
2522+The module is loaded as part of module `pandoc` and can either
2523+be accessed via the `pandoc.mediabag` field, or explicitly
2524+required, e.g.:
24652525
24662526 local mb = require 'pandoc.mediabag'
24672527
@@ -2522,11 +2582,11 @@ including their contents, is required. For all other cases,
25222582
25232583Returns:
25242584
2525− - The iterator function; must be called with the iterator state
2526− and the current iterator value.
2527− - Iterator state – an opaque value to be passed to the iterator
2528− function.
2529− - Initial iterator value.
2585+- The iterator function; must be called with the iterator
2586+ state and the current iterator value.
2587+- Iterator state -- an opaque value to be passed to the
2588+ iterator function.
2589+- Initial iterator value.
25302590
25312591Usage:
25322592
@@ -2540,10 +2600,10 @@ Usage:
25402600
25412601Get a summary of the current media bag contents.
25422602
2543−Returns: A list of elements summarizing each entry in the
2544−media bag. The summary item contains the keys `path`,
2545−`type`, and `length`, giving the filepath, MIME type, and
2546−length of contents in bytes, respectively.
2603+Returns: A list of elements summarizing each entry in the media
2604+bag. The summary item contains the keys `path`, `type`, and
2605+`length`, giving the filepath, MIME type, and length of contents
2606+in bytes, respectively.
25472607
25482608Usage:
25492609
@@ -2581,9 +2641,9 @@ Usage:
25812641
25822642`fetch (source, base_url)`
25832643
2584−Fetches the given source from a URL or local file. Returns
2585−two values: the contents of the file and the MIME type (or
2586−an empty string).
2644+Fetches the given source from a URL or local file. Returns two
2645+values: the contents of the file and the MIME type (or an empty
2646+string).
25872647
25882648Returns:
25892649
@@ -2595,135 +2655,108 @@ Usage:
25952655 local diagram_url = "https://pandoc.org/diagram.jpg"
25962656 local contents = pandoc.mediabag.fetch(diagram_url, ".")
25972657
2598−
25992658# Module pandoc.List
26002659
2601−Pandoc's List type and helper methods.
2602−
2603−This module is loaded and available as `pandoc.List`. Older
2604−versions up-to and including pandoc 2.6 require the module to be
2605−loaded explicitly. Example:
2606−
2607− local List = require 'pandoc.List'
2608−
2609−The above remains the recommended method to use this module; it
2610−provides the List type under an idiomatic name and is fully
2611−backwards compatible.
2660+Pandoc\'s List type and helper methods
26122661
26132662## Metamethods
26142663
2615−### concat {#pandoc.List:__concat}
2664+[`pandoc.List:__concat (list)`]{#pandoc.List:__concat}
26162665
2617−`pandoc.List:__concat (list)`
2666+: Concatenates two lists.
26182667
2619−Concatenates two lists.
2668+ Parameters:
26202669
2621−Parameters:
2670+ `list`:
2671+ : second list concatenated to the first
26222672
2623−`list`:
2624−: second list concatenated to the first
2625−
2626−Returns: a new list containing all elements from list1 and
2627−list2
2673+ Returns: a new list containing all elements from list1 and
2674+ list2
26282675
26292676## Methods
26302677
2631−### clone {#pandoc.List:clone}
2632−
2633−`pandoc.List:clone ()` {#pandoc.List:clone}
2678+[`pandoc.List:clone ()`]{#pandoc.List:clone}
26342679
2635−Returns a (shallow) copy of the list.
2680+: Returns a (shallow) copy of the list.
26362681
2637−### includes {#pandoc.List:includes}
2682+[`pandoc.List:includes (needle, init)`]{#pandoc.List:includes}
26382683
2639−`pandoc.List:includes (needle, init)`
2684+: Checks if the list has an item equal to the given needle.
26402685
2641−Checks if the list has an item equal to the given needle.
2642−
2643−Parameters:
2686+ Parameters:
26442687
2645−`needle`:
2646−: item to search for
2688+ `needle`:
2689+ : item to search for
26472690
2648−`init`:
2649−: index at which the search is started
2691+ `init`:
2692+ : index at which the search is started
26502693
2651−Returns: true if a list item is equal to the needle, false
2652−otherwise
2694+ Returns: true if a list item is equal to the needle, false
2695+ otherwise
26532696
2654−### find {#pandoc.List:find}
2697+[`pandoc.List:find (needle, init)`]{#pandoc.List:find}
26552698
2656−`pandoc.List:find (needle, init)`
2699+: Returns the value and index of the first occurrence of the
2700+ given item.
26572701
2658−Returns the value and index of the first occurrence of the
2659−given item.
2702+ Parameters:
26602703
2661−Parameters:
2704+ `needle`:
2705+ : item to search for
26622706
2663−`needle`:
2664−: item to search for
2707+ `init`:
2708+ : index at which the search is started
26652709
2666−`init`:
2667−: index at which the search is started
2710+ Returns: first item equal to the needle, or nil if no such
2711+ item exists.
26682712
2669−Returns: first item equal to the needle, or nil if no such
2670−item exists.
2713+[`pandoc.List:find_if (pred, init)`]{#pandoc.List:find_if}
26712714
2672−### find_if {#pandoc.List:find_if}
2715+: Returns the value and index of the first element for which
2716+ the predicate holds true.
26732717
2674−`pandoc.List:find_if (pred, init)`
2718+ Parameters:
26752719
2676−Returns the value and index of the first element for which
2677−the predicate holds true.
2720+ `pred`:
2721+ : the predicate function
26782722
2679−Parameters:
2723+ `init`:
2724+ : index at which the search is started
26802725
2681−`pred`:
2682−: the predicate function
2726+ Returns: first item for which \`test\` succeeds, or nil if
2727+ no such item exists.
26832728
2684−`init`:
2685−: index at which the search is started
2729+[`pandoc.List:extend (list)`]{#pandoc.List:extend}
26862730
2687−Returns: first item for which \`test\` succeeds, or nil if
2688−no such item exists.
2731+: Adds the given list to the end of this list.
26892732
2690−### extend {#pandoc.List:extend}
2733+ Parameters:
26912734
2692−`pandoc.List:extend (list)`
2735+ `list`:
2736+ : list to appended
26932737
2694−Adds the given list to the end of this list.
2738+[`pandoc.List:map (fn)`]{#pandoc.List:map}
26952739
2696−Parameters:
2740+: Returns a copy of the current list by applying the given
2741+ function to all elements.
26972742
2698−`list`:
2699−: list to appended
2743+ Parameters:
27002744
2701−### map {#pandoc.List:map}
2745+ `fn`:
2746+ : function which is applied to all list items.
27022747
2703−`pandoc.List:map (fn)`
2748+[`pandoc.List:filter (pred)`]{#pandoc.List:filter}
27042749
2705−Returns a copy of the current list by applying the given
2706−function to all elements.
2750+: Returns a new list containing all items satisfying a given
2751+ condition.
27072752
2708−Parameters:
2753+ Parameters:
27092754
2710−`fn`:
2711−: function which is applied to all list items.
2755+ `pred`:
2756+ : condition items must satisfy.
27122757
2713−### filter {#pandoc.List:filter}
2714−
2715−`pandoc.List:filter (pred)`
2716−
2717−Returns a new list containing all items satisfying a given
2718−condition.
2719−
2720−Parameters:
2721−
2722−`pred`:
2723−: condition items must satisfy.
2724−
2725−Returns: a new list containing all items for which \`test\`
2726−was true.
2758+ Returns: a new list containing all items for which \`test\`
2759+ was true.
27272760
27282761# Module pandoc.system
27292762
@@ -2749,8 +2782,8 @@ Retrieve the entire environment as a string-indexed table.
27492782
27502783Returns:
27512784
2752−- A table mapping environment variables names to their string value
2753− (table).
2785+- A table mapping environment variables names to their string
2786+ value (table).
27542787
27552788### get\_working\_directory {#system-get_working_directory}
27562789
@@ -2760,7 +2793,7 @@ Obtain the current working directory as an absolute path.
27602793
27612794Returns:
27622795
2763−- The current working directory (string).
2796+- The current working directory (string).
27642797
27652798### with\_environment {#system-with_environment}
27662799
@@ -2796,16 +2829,16 @@ The directory is deleted after the callback returns.
27962829Parameters:
27972830
27982831`parent_dir`
2799−: Parent directory to create the directory in (string). If this
2800− parameter is omitted, the system's canonical temporary
2832+: Parent directory to create the directory in (string). If
2833+ this parameter is omitted, the system's canonical temporary
28012834 directory is used.
28022835
28032836`templ`
28042837: Directory name template (string).
28052838
28062839`callback`
2807−: Function which takes the name of the temporary directory as its
2808− first argument (function).
2840+: Function which takes the name of the temporary directory as
2841+ its first argument (function).
28092842
28102843Returns:
28112844
@@ -2833,7 +2866,6 @@ Returns:
28332866
28342867- The result(s) of the call to `callback`
28352868
2836−
28372869# Module pandoc.types
28382870
28392871Constructors for types which are not part of the pandoc AST.