@@ -11,10 +11,11 @@ title: Pandoc Lua Filters
11Pandoc has long supported filters, which allow the pandoc
11Pandoc has long supported filters, which allow the pandoc
12abstract syntax tree (AST) to be manipulated between the parsing
12abstract syntax tree (AST) to be manipulated between the parsing
13and the writing phase. [Traditional pandoc
13and the writing phase. [Traditional pandoc
14−filters](https://pandoc.org/filters.html) accept a JSON representation of the
14+filters](https://pandoc.org/filters.html) accept a JSON
15−pandoc AST and produce an altered JSON representation of the
15+representation of the pandoc AST and produce an altered JSON
16−AST. They may be written in any programming language, and
16+representation of the AST. They may be written in any
17−invoked from pandoc using the `--filter` option.
17+programming language, and invoked from pandoc using the
19Although traditional filters are very flexible, they have a
20Although traditional filters are very flexible, they have a
20couple of disadvantages. First, there is some overhead in
21couple of disadvantages. First, there is some overhead in
@@ -66,12 +67,12 @@ manual (MANUAL.txt) to HTML, with versions of the same JSON
66filter written in compiled Haskell (`smallcaps`) and interpreted
67filter written in compiled Haskell (`smallcaps`) and interpreted
67Python (`smallcaps.py`):
68Python (`smallcaps.py`):
69− Command Time
70+ Command Time
70− ----------------------------------------- -------
71+ --------------------------------------- -------
71− `pandoc` 1.01s
72+ `pandoc` 1.01s
72− `pandoc --filter ./smallcaps` 1.36s
73+ `pandoc --filter ./smallcaps` 1.36s
73− `pandoc --filter ./smallcaps.py` 1.40s
74+ `pandoc --filter ./smallcaps.py` 1.40s
74− `pandoc --lua-filter ./smallcaps.lua` 1.03s
75+ `pandoc --lua-filter ./smallcaps.lua` 1.03s
76As you can see, the lua filter avoids the substantial overhead
77As you can see, the lua filter avoids the substantial overhead
77associated with marshalling to and from JSON over a pipe.
78associated with marshalling to and from JSON over a pipe.
@@ -114,9 +115,9 @@ The return of a filter function must one of the following:
114- a pandoc object: this must be of the same type as the input
115- a pandoc object: this must be of the same type as the input
115 and will replace the original object.
116 and will replace the original object.
116- a list of pandoc objects: these will replace the original
117- a list of pandoc objects: these will replace the original
117− object; the list is merged with the neighbors of the original
118+ object; the list is merged with the neighbors of the
118− objects (spliced into the list the original object belongs
119+ original objects (spliced into the list the original object
119− to); returning an empty list deletes the object.
120+ belongs to); returning an empty list deletes the object.
121The function's output must result in an element of the same type
122The function's output must result in an element of the same type
122as the input. This means a filter function acting on an inline
123as the input. This means a filter function acting on an inline
@@ -135,7 +136,6 @@ Elements without matching functions are left untouched.
135See [module documentation](#module-pandoc) for a list of pandoc
136See [module documentation](#module-pandoc) for a list of pandoc
139## Global variables
139## Global variables
141Pandoc passes additional data to Lua filters by setting global
141Pandoc passes additional data to Lua filters by setting global
@@ -151,12 +151,13 @@ variables.
151: Table of the options which were provided to the parser.
151: Table of the options which were provided to the parser.
153`PANDOC_VERSION`
153`PANDOC_VERSION`
154−: Contains the pandoc version as a [Version object] which
154+: Contains the pandoc version as a [Version
155+ object](#type-ref-Version) which behaves like a numerically
155− behaves like a numerically indexed table, most significant
156+ indexed table, most significant number first. E.g., for
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
157+ pandoc 2.7.3, the value of the variable is equivalent to a
158− `tostring(PANDOC_VERSION)` to produce a version string. This
158+ table `{2, 7, 3}`. Use `tostring(PANDOC_VERSION)` to produce
159− variable is also set in custom writers.
159+ a version string. This variable is also set in custom
161`PANDOC_API_VERSION`
162`PANDOC_API_VERSION`
162: Contains the version of the pandoc-types API against which
163: Contains the version of the pandoc-types API against which
@@ -178,8 +179,6 @@ variables.
178 variable is of type [CommonState](#type-ref-CommonState) and
179 variable is of type [CommonState](#type-ref-CommonState) and
179 is read-only.
180 is read-only.
181−[Version object]: #type-ref-Version
183# Pandoc Module
182# Pandoc Module
185The `pandoc` lua module is loaded into the filter's lua
184The `pandoc` lua module is loaded into the filter's lua
@@ -228,8 +227,8 @@ default modules.
229The following snippet is an example of code that might be useful
228The following snippet is an example of code that might be useful
230when added to `init.lua`. The snippet adds all unicode-aware
229when added to `init.lua`. The snippet adds all unicode-aware
231−functions defined in the [`text` module] to the default `string`
230+functions defined in the [`text` module](#module-text) to the
232−module, prefixed with the string `uc_`.
231+default `string` module, prefixed with the string `uc_`.
234``` {.lua}
233``` {.lua}
235for name, fn in pairs(require 'text') do
234for name, fn in pairs(require 'text') do
@@ -240,14 +239,11 @@ end
240This makes it possible to apply these functions on strings using
239This makes it possible to apply these functions on strings using
241colon syntax (`mystring:uc_upper()`).
240colon syntax (`mystring:uc_upper()`).
243−[`text` module]: #module-text
245# Examples
242# Examples
247−The following filters are presented as examples.
244+The following filters are presented as examples. A repository of
248−A repository of useful lua filters (which may also serve
245+useful lua filters (which may also serve as good examples) is
249−as good examples) is available at
250−<https://github.com/pandoc/lua-filters>.
246+available at <https://github.com/pandoc/lua-filters>.
252## Macro substitution.
248## Macro substitution.
@@ -552,13 +548,14 @@ end
553This filter converts raw LaTeX tikz environments into images. It
549This filter converts raw LaTeX tikz environments into images. It
554works with both PDF and HTML output. The tikz code is compiled
550works with both PDF and HTML output. The tikz code is compiled
555−to an image using `pdflatex`, and the image is converted from pdf
551+to an image using `pdflatex`, and the image is converted from
552+pdf to svg format using
556−to svg format using [`pdf2svg`](https://github.com/dawbarton/pdf2svg),
553+[`pdf2svg`](https://github.com/dawbarton/pdf2svg), so both of
557−so both of these must be in the system path. Converted images
554+these must be in the system path. Converted images are cached in
558−are cached in the working directory and given filenames based on
555+the working directory and given filenames based on a hash of the
559−a hash of the source, so that they need not be regenerated each
556+source, so that they need not be regenerated each time the
560−time the document is built. (A more sophisticated version of
557+document is built. (A more sophisticated version of this might
561−this might put these in a special cache directory.)
558+put these in a special cache directory.)
563``` {.lua}
560``` {.lua}
564local function tikz2image(src, filetype, outfile)
561local function tikz2image(src, filetype, outfile)
@@ -637,12 +634,11 @@ Example of use:
637 \end{tikzpicture}
634 \end{tikzpicture}
641# Lua type reference
637# Lua type reference
643This section describes the types of objects available to Lua
639This section describes the types of objects available to Lua
644−filters. See the [pandoc module](#module-pandoc}) for functions
640+filters. See the [pandoc module](#module-pandoc%7D) for
645−to create these objects.
641+functions to create these objects.
647## Shared Properties
643## Shared Properties
@@ -666,16 +662,16 @@ Object equality is determined via
666[`pandoc.utils.equals`](#utils-equals).
662[`pandoc.utils.equals`](#utils-equals).
669−: document content ([List] of [Block]s)
665+: document content ([List](#module-pandoc.list) of
666+ [Block](#type-ref-Block)s)
672−: document meta information ([Meta] object)
669+: document meta information ([Meta](#Meta) object)
675## Meta {#type-ref-meta}
671## Meta {#type-ref-meta}
677Meta information on a document; string-indexed collection of
673Meta information on a document; string-indexed collection of
678−[MetaValue]s.
674+[MetaValue](#type-ref-MetaValue)s.
680Object equality is determined via
676Object equality is determined via
681[`pandoc.utils.equals`](#utils-equals).
677[`pandoc.utils.equals`](#utils-equals).
@@ -689,7 +685,8 @@ Object equality is determined via
690### MetaBlocks {#type-ref-MetaBlocks}
686### MetaBlocks {#type-ref-MetaBlocks}
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)
@@ -702,7 +699,8 @@ Plain Lua boolean value (boolean)
703### MetaInlines {#type-ref-MetaInlines}
700### MetaInlines {#type-ref-MetaInlines}
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)
@@ -711,7 +709,8 @@ Fields:
712### MetaList {#type-ref-iMetaList}
710### MetaList {#type-ref-iMetaList}
714−A list of other [MetaValue]s. ([List])
712+A list of other [MetaValue](#type-ref-MetaValue)s.
713+([List](#module-pandoc.list))
@@ -734,7 +733,6 @@ with the same name as those listed.
735Plain Lua string value (string)
734Plain Lua string value (string)
738## Block {#type-ref-Block}
736## Block {#type-ref-Block}
740Object equality is determined via
738Object equality is determined via
@@ -745,7 +743,8 @@ Object equality is determined via
745A block quote element
743A block quote element
748−: block content ([List] of [Block]s)
746+: block content ([List](#module-pandoc.list) of
747+ [Block](#type-ref-Block)s)
750`tag`, `t`
749`tag`, `t`
751: the literal `BlockQuote` (string)
750: the literal `BlockQuote` (string)
@@ -755,7 +754,8 @@ content:
755A bullet list
754A bullet list
758−: list of items ([List] of [Block]s)
757+: list of items ([List](#module-pandoc.list) of
758+ [Block](#type-ref-Block)s)
760`tag`, `t`
760`tag`, `t`
761: the literal `BulletList` (string)
761: the literal `BulletList` (string)
@@ -768,16 +768,18 @@ Block of code.
768: code string (string)
768: code string (string)
771−: element attributes ([Attr])
771+: element attributes ([Attr](#type-ref-Attr))
773`identifier`
773`identifier`
774: alias for `attr.identifier` (string)
774: alias for `attr.identifier` (string)
777−: alias for `attr.classes` ([List] of strings)
777+: alias for `attr.classes` ([List](#module-pandoc.list) of
779`attributes`
780`attributes`
780−: alias for `attr.attributes` ([Attributes])
781+: alias for `attr.attributes`
782+ ([Attributes](#type-ref-Attributes))
782`tag`, `t`
784`tag`, `t`
783: the literal `CodeBlock` (string)
785: the literal `CodeBlock` (string)
@@ -797,19 +799,22 @@ Definition list, containing terms and their explanation.
797Generic block container with attributes
799Generic block container with attributes
800−: block content ([List] of [Block]s)
802+: block content ([List](#module-pandoc.list) of
803+ [Block](#type-ref-Block)s)
803−: element attributes ([Attr])
806+: element attributes ([Attr](#type-ref-Attr))
805`identifier`
808`identifier`
806: alias for `attr.identifier` (string)
809: alias for `attr.identifier` (string)
809−: alias for `attr.classes` ([List] of strings)
812+: alias for `attr.classes` ([List](#module-pandoc.list) of
811`attributes`
815`attributes`
812−: alias for `attr.attributes` ([Attributes])
816+: alias for `attr.attributes`
817+ ([Attributes](#type-ref-Attributes))
814`tag`, `t`
819`tag`, `t`
815: the literal `Div` (string)
820: the literal `Div` (string)
@@ -822,24 +827,26 @@ Creates a header element.
822: header level (integer)
827: header level (integer)
825−: inline content ([List] of [Inline]s)
830+: inline content ([List](#module-pandoc.list) of
831+ [Inline](#type-ref-Inline)s)
828−: element attributes ([Attr])
834+: element attributes ([Attr](#type-ref-Attr))
830`identifier`
836`identifier`
831: alias for `attr.identifier` (string)
837: alias for `attr.identifier` (string)
834−: alias for `attr.classes` ([List] of strings)
840+: alias for `attr.classes` ([List](#module-pandoc.list) of
836`attributes`
843`attributes`
837−: alias for `attr.attributes` ([Attributes])
844+: alias for `attr.attributes`
845+ ([Attributes](#type-ref-Attributes))
839`tag`, `t`
847`tag`, `t`
840: the literal `Header` (string)
848: the literal `Header` (string)
843### HorizontalRule {#type-ref-HorizontalRule}
850### HorizontalRule {#type-ref-HorizontalRule}
845A horizontal rule.
852A horizontal rule.
@@ -849,7 +856,7 @@ A horizontal rule.
850### LineBlock {#type-ref-LineBlock}
857### LineBlock {#type-ref-LineBlock}
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
853by a newline.
860by a newline.
@@ -871,10 +878,11 @@ target format.
871An ordered list.
878An ordered list.
874−: list items ([List] of [Block]s)
881+: list items ([List](#module-pandoc.list) of
882+ [Block](#type-ref-Block)s)
876`listAttributes`
884`listAttributes`
877−: list parameters ([ListAttributes])
885+: list parameters ([ListAttributes](#ListAttributes))
880: alias for `listAttributes.start` (integer)
888: alias for `listAttributes.start` (integer)
@@ -893,7 +901,8 @@ An ordered list.
893A paragraph
901A paragraph
896−: inline content ([List] of [Inline]s)
904+: inline content ([List](#module-pandoc.list) of
905+ [Inline](#type-ref-Inline)s)
898`tag`, `t`
907`tag`, `t`
899: the literal `Para` (string)
908: the literal `Para` (string)
@@ -903,7 +912,8 @@ A paragraph
903Plain text, not a paragraph
912Plain text, not a paragraph
906−: inline content ([List] of [Inline]s)
915+: inline content ([List](#module-pandoc.list) of
916+ [Inline](#type-ref-Inline)s)
908`tag`, `t`
918`tag`, `t`
909: the literal `Plain` (string)
919: the literal `Plain` (string)
@@ -926,19 +936,24 @@ Raw content of a specified format.
929−: table caption ([List] of [Inline]s)
939+: table caption ([List](#module-pandoc.list) of
940+ [Inline](#type-ref-Inline)s)
932−: column alignments ([List] of [Alignment]s)
943+: column alignments ([List](#module-pandoc.list) of
944+ [Alignment](#type-ref-Alignment)s)
935: column widths (number)
947: column widths (number)
938−: header row ([List] of [table cells])
950+: header row ([List](#module-pandoc.list) of [table
951+ cells](#type-ref-table-cell))
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))
943`tag`, `t`
958`tag`, `t`
944: the literal `Table` (string)
959: the literal `Table` (string)
@@ -952,64 +967,70 @@ left-aligned, right-aligned, and centered, respectively. The
952default alignment is `AlignDefault` (often equivalent to
967default alignment is `AlignDefault` (often equivalent to
953centered).
968centered).
955−[Alignment]: #type-ref-Alignment
956−[table cells]: #type-ref-table-cell
958## Inline {#type-ref-Inline}
970## Inline {#type-ref-Inline}
960Object equality is determined via
972Object equality is determined via
961[`pandoc.utils.equals`](#utils-equals).
973[`pandoc.utils.equals`](#utils-equals).
963### Cite {#type-ref-Cite}
975### Cite {#type-ref-Cite}
967−: ([List] of [Inline]s)
980+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
969`citations`
982`citations`
970−: citation entries ([List] of [citations])
983+: citation entries ([List](#module-pandoc.list) of
984+ [citations](#type-ref-Citation))
972`tag`, `t`
986`tag`, `t`
973: the literal `Cite` (string)
987: the literal `Cite` (string)
975### Code {#type-ref-Code}
989### Code {#type-ref-Code}
976Inline code
991Inline code
979: code string (string)
994: code string (string)
982−: attributes ([Attr])
997+: attributes ([Attr](#type-ref-Attr))
984`identifier`
999`identifier`
985: alias for `attr.identifier` (string)
1000: alias for `attr.identifier` (string)
987`classes`
1002`classes`
988−: alias for `attr.classes` ([List] of strings)
1003+: alias for `attr.classes` ([List](#module-pandoc.list) of
990`attributes`
1006`attributes`
991−: alias for `attr.attributes` ([Attributes])
1007+: alias for `attr.attributes`
1008+ ([Attributes](#type-ref-Attributes))
993`tag`, `t`
1010`tag`, `t`
994: the literal `Code` (string)
1011: the literal `Code` (string)
996### Emph {#type-ref-Emph}
1013### Emph {#type-ref-Emph}
997Emphasized text
1015Emphasized text
999`content`
1017`content`
1000−: inline content ([List] of [Inline]s)
1018+: inline content ([List](#module-pandoc.list) of
1019+ [Inline](#type-ref-Inline)s)
1002`tag`, `t`
1021`tag`, `t`
1003: the literal `Emph` (string)
1022: the literal `Emph` (string)
1005### Image {#type-ref-Image}
1024### Image {#type-ref-Image}
1006−Image: alt text (list of inlines), target
1026+Image: alt text (list of inlines), target
1009−: attributes ([Attr])
1029+: attributes ([Attr](#type-ref-Attr))
1011`caption`
1031`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)
1015: path to the image file (string)
1036: path to the image file (string)
@@ -1021,28 +1042,33 @@ Image: alt text (list of inlines), target
1021: alias for `attr.identifier` (string)
1042: alias for `attr.identifier` (string)
1023`classes`
1044`classes`
1024−: alias for `attr.classes` ([List] of strings)
1045+: alias for `attr.classes` ([List](#module-pandoc.list) of
1026`attributes`
1048`attributes`
1027−: alias for `attr.attributes` ([Attributes])
1049+: alias for `attr.attributes`
1050+ ([Attributes](#type-ref-Attributes))
1029`tag`, `t`
1052`tag`, `t`
1030: the literal `Image` (string)
1053: the literal `Image` (string)
1032### LineBreak {#type-ref-LineBreak}
1055### LineBreak {#type-ref-LineBreak}
1033Hard line break
1057Hard line break
1035`tag`, `t`
1059`tag`, `t`
1036: the literal `LineBreak` (string)
1060: the literal `LineBreak` (string)
1038### Link {#type-ref-Link}
1062### Link {#type-ref-Link}
1039Hyperlink: alt text (list of inlines), target
1064Hyperlink: alt text (list of inlines), target
1042−: attributes ([Attr])
1067+: attributes ([Attr](#type-ref-Attr))
1044`content`
1069`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)
1048: the link target (string)
1074: the link target (string)
@@ -1051,15 +1077,18 @@ Hyperlink: alt text (list of inlines), target
1051: alias for `attr.identifier` (string)
1077: alias for `attr.identifier` (string)
1053`classes`
1079`classes`
1054−: alias for `attr.classes` ([List] of strings)
1080+: alias for `attr.classes` ([List](#module-pandoc.list) of
1056`attributes`
1083`attributes`
1057−: alias for `attr.attributes` ([Attributes])
1084+: alias for `attr.attributes`
1085+ ([Attributes](#type-ref-Attributes))
1059`tag`, `t`
1087`tag`, `t`
1060: the literal `Link` (string)
1088: the literal `Link` (string)
1062### Math {#type-ref-Math}
1090### Math {#type-ref-Math}
1063TeX math (literal)
1092TeX math (literal)
1065`mathtype`
1094`mathtype`
@@ -1074,15 +1103,17 @@ TeX math (literal)
1074: the literal `Math` (string)
1103: the literal `Math` (string)
1076### Note {#type-ref-Note}
1105### Note {#type-ref-Note}
1077Footnote or endnote
1107Footnote or endnote
1079`content`
1109`content`
1080−: ([List] of [Block]s)
1110+: ([List](#module-pandoc.list) of [Block](#type-ref-Block)s)
1082`tag`, `t`
1112`tag`, `t`
1083: the literal `Note` (string)
1113: the literal `Note` (string)
1085### Quoted {#type-ref-Quoted}
1115### Quoted {#type-ref-Quoted}
1086Quoted text
1117Quoted text
1088`quotetype`
1119`quotetype`
@@ -1090,12 +1121,14 @@ Quoted text
1090 `DoubleQuote` (string)
1121 `DoubleQuote` (string)
1092`content`
1123`content`
1093−: quoted text ([List] of [Inline]s)
1124+: quoted text ([List](#module-pandoc.list) of
1125+ [Inline](#type-ref-Inline)s)
1095`tag`, `t`
1127`tag`, `t`
1096: the literal `Quoted` (string)
1128: the literal `Quoted` (string)
1098### RawInline {#type-ref-RawInline}
1130### RawInline {#type-ref-RawInline}
1099Raw inline
1132Raw inline
@@ -1108,48 +1141,56 @@ Raw inline
1108: the literal `RawInline` (string)
1141: the literal `RawInline` (string)
1110### SmallCaps {#type-ref-SmallCaps}
1143### SmallCaps {#type-ref-SmallCaps}
1111Small caps text
1145Small caps text
1113`content`
1147`content`
1114−: ([List] of [Inline]s)
1148+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
1116`tag`, `t`
1150`tag`, `t`
1117: the literal `SmallCaps` (string)
1151: the literal `SmallCaps` (string)
1119### SoftBreak {#type-ref-SoftBreak}
1153### SoftBreak {#type-ref-SoftBreak}
1120Soft line break
1155Soft line break
1122`tag`, `t`
1157`tag`, `t`
1123: the literal `SoftBreak` (string)
1158: the literal `SoftBreak` (string)
1125### Space {#type-ref-Space}
1160### Space {#type-ref-Space}
1126Inter-word space
1162Inter-word space
1128`tag`, `t`
1164`tag`, `t`
1129: the literal `Space` (string)
1165: the literal `Space` (string)
1131### Span {#type-ref-Span}
1167### Span {#type-ref-Span}
1132Generic inline container with attributes
1169Generic inline container with attributes
1135−: attributes ([Attr])
1172+: attributes ([Attr](#type-ref-Attr))
1137`content`
1174`content`
1138−: wrapped content ([List] of [Inline]s)
1175+: wrapped content ([List](#module-pandoc.list) of
1176+ [Inline](#type-ref-Inline)s)
1140`identifier`
1178`identifier`
1141: alias for `attr.identifier` (string)
1179: alias for `attr.identifier` (string)
1143`classes`
1181`classes`
1144−: alias for `attr.classes` ([List] of strings)
1182+: alias for `attr.classes` ([List](#module-pandoc.list) of
1146`attributes`
1185`attributes`
1147−: alias for `attr.attributes` ([Attributes])
1186+: alias for `attr.attributes`
1187+ ([Attributes](#type-ref-Attributes))
1149`tag`, `t`
1189`tag`, `t`
1150: the literal `Span` (string)
1190: the literal `Span` (string)
1152### Str {#type-ref-Str}
1192### Str {#type-ref-Str}
@@ -1159,37 +1200,45 @@ Text
1159: the literal `Str` (string)
1200: the literal `Str` (string)
1161### Strikeout {#type-ref-Strikeout}
1202### Strikeout {#type-ref-Strikeout}
1162Strikeout text
1204Strikeout text
1164`content`
1206`content`
1165−: inline content ([List] of [Inline]s)
1207+: inline content ([List](#module-pandoc.list) of
1208+ [Inline](#type-ref-Inline)s)
1167`tag`, `t`
1210`tag`, `t`
1168: the literal `Strikeout` (string)
1211: the literal `Strikeout` (string)
1170### Strong {#type-ref-Strong}
1213### Strong {#type-ref-Strong}
1171Strongly emphasized text
1215Strongly emphasized text
1173`content`
1217`content`
1174−: inline content ([List] of [Inline]s)
1218+: inline content ([List](#module-pandoc.list) of
1219+ [Inline](#type-ref-Inline)s)
1176`tag`, `t`
1221`tag`, `t`
1177: the literal `Strong` (string)
1222: the literal `Strong` (string)
1179### Subscript {#type-ref-Subscript}
1224### Subscript {#type-ref-Subscript}
1180Subscripted text
1226Subscripted text
1182`content`
1228`content`
1183−: inline content ([List] of [Inline]s)
1229+: inline content ([List](#module-pandoc.list) of
1230+ [Inline](#type-ref-Inline)s)
1185`tag`, `t`
1232`tag`, `t`
1186: the literal `Subscript` (string)
1233: the literal `Subscript` (string)
1188### Superscript {#type-ref-Superscript}
1235### Superscript {#type-ref-Superscript}
1189Superscripted text
1237Superscripted text
1191`content`
1239`content`
1192−: inline content ([List] of [Inline]s)
1240+: inline content ([List](#module-pandoc.list) of
1241+ [Inline](#type-ref-Inline)s)
1194`tag`, `t`
1243`tag`, `t`
1195: the literal `Superscript` (string)
1244: the literal `Superscript` (string)
@@ -1207,10 +1256,11 @@ Object equality is determined via
1207: element identifier (string)
1256: element identifier (string)
1209`classes`
1258`classes`
1210−: element classes ([List] of strings)
1259+: element classes ([List](#module-pandoc.list) of strings)
1212`attributes`
1261`attributes`
1213−: collection of key/value pairs ([Attributes])
1262+: collection of key/value pairs
1263+ ([Attributes](#type-ref-Attributes))
1215### Attributes {#type-ref-Attributes}
1265### Attributes {#type-ref-Attributes}
@@ -1232,10 +1282,12 @@ Object equality is determined via
1232 `NormalCitation` (string)
1282 `NormalCitation` (string)
1235−: citation prefix ([List] of [Inline]s)
1285+: citation prefix ([List](#module-pandoc.list) of
1286+ [Inline](#type-ref-Inline)s)
1238−: citation suffix ([List] of [Inline]s)
1289+: citation suffix ([List](#module-pandoc.list) of
1290+ [Inline](#type-ref-Inline)s)
1240`note_num`
1292`note_num`
1241: note number (integer)
1293: note number (integer)
@@ -1244,6 +1296,7 @@ Object equality is determined via
1244: hash (integer)
1296: hash (integer)
1246### ListAttributes {#type-ref-ListAttributes}
1298### ListAttributes {#type-ref-ListAttributes}
1247List attributes
1300List attributes
1249Object equality is determined via
1302Object equality is determined via
@@ -1253,19 +1306,19 @@ Object equality is determined via
1253: number of the first list item (integer)
1306: number of the first list item (integer)
1256−: style used for list numbers; possible values are `DefaultStyle`,
1309+: style used for list numbers; possible values are
1257− `Example`, `Decimal`, `LowerRoman`, `UpperRoman`,
1310+ `DefaultStyle`, `Example`, `Decimal`, `LowerRoman`,
1258− `LowerAlpha`, and `UpperAlpha` (string)
1311+ `UpperRoman`, `LowerAlpha`, and `UpperAlpha` (string)
1260`delimiter`
1313`delimiter`
1261: delimiter of list numbers; one of `DefaultDelim`, `Period`,
1314: delimiter of list numbers; one of `DefaultDelim`, `Period`,
1262 `OneParen`, and `TwoParens` (string)
1315 `OneParen`, and `TwoParens` (string)
1265## Hierarchical Element {#type-ref-Element}
1317## Hierarchical Element {#type-ref-Element}
1267Hierarchical elements can be either *Sec* (sections) or *Blk*
1319Hierarchical 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.
1270### Sec {#type-ref-Sec}
1323### Sec {#type-ref-Sec}
@@ -1278,22 +1331,23 @@ document contents.
1278: header level (integer)
1331: header level (integer)
1280`numbering`
1333`numbering`
1281−: section numbering ([list] of integers)
1334+: section numbering ([list](#module-pandoc.list) of integers)
1284−: header attributes ([Attr])
1337+: header attributes ([Attr](#type-ref-Attr))
1287−: header content ([list] of [Inline]s)
1340+: header content ([list](#module-pandoc.list) of
1341+ [Inline](#type-ref-Inline)s)
1289`contents`
1343`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)
1292`tag`, `t`
1348`tag`, `t`
1293: constant `Sec` (string)
1349: constant `Sec` (string)
1295−[hierarchical element]: #Element
1297## ReaderOptions {#type-ref-ReaderOptions}
1351## ReaderOptions {#type-ref-ReaderOptions}
1299Pandoc reader options
1353Pandoc reader options
@@ -1323,7 +1377,7 @@ Pandoc reader options
1323 (boolean)
1377 (boolean)
1325`tab_stop`
1379`tab_stop`
1326−: width (i.e. equivalent number of spaces) of tab stops
1380+: width (i.e. equivalent number of spaces) of tab stops
1327 (integer)
1381 (integer)
1329`track_changes`
1383`track_changes`
@@ -1336,21 +1390,24 @@ The state used by pandoc to collect information and make it
1336available to readers and writers.
1390available to readers and writers.
1338`input_files`
1392`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)
1341`output_file`
1396`output_file`
1342: Output file from command line (string or nil)
1397: Output file from command line (string or nil)
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)
1347`request_headers`
1404`request_headers`
1348: Headers to add for HTTP requests; table with header names as
1405: Headers to add for HTTP requests; table with header names as
1349 keys and header contents as value (table)
1406 keys and header contents as value (table)
1351`resource_path`
1408`resource_path`
1352−: Path to search for resources like included images ([List] of
1409+: Path to search for resources like included images
1353− strings)
1410+ ([List](#module-pandoc.list) of strings)
1355`source_url`
1412`source_url`
1356: Absolute URL or directory of first source file (string or
1413: Absolute URL or directory of first source file (string or
@@ -1367,8 +1424,8 @@ available to readers and writers.
1368## LogMessage {#type-ref-LogMessage}
1425## LogMessage {#type-ref-LogMessage}
1370−A pandoc log message. Object have no fields, but can be converted
1427+A pandoc log message. Object have no fields, but can be
1371−to a string via `tostring`.
1428+converted to a string via `tostring`.
1373## Version {#type-ref-Version}
1430## Version {#type-ref-Version}
@@ -1402,9 +1459,10 @@ Parameters:
1402: minimum expected version ([Version](#type-ref-Version))
1459: minimum expected version ([Version](#type-ref-Version))
1404`error_message`
1461`error_message`
1405−: optional error message template. The string is used as format
1462+: optional error message template. The string is used as
1406− string, with the expected and actual versions as arguments.
1463+ format string, with the expected and actual versions as
1464+ arguments. Defaults to
1407− Defaults to `"expected version %s or newer, got %s"`.
1465+ `"expected version %s or newer, got %s"`.
@@ -1414,16 +1472,6 @@ Usage:
1414 'pandoc-types is too old: expected version %s, got %s'
1472 'pandoc-types is too old: expected version %s, got %s'
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
1427# Module text
1475# Module text
1429UTF-8 aware text manipulation functions, implemented in Haskell.
1477UTF-8 aware text manipulation functions, implemented in Haskell.
@@ -1476,714 +1524,732 @@ Lua functions for pandoc scripts.
1477## Pandoc Document
1525## Pandoc Document
1479−### Pandoc {#Pandoc}
1527+[`Pandoc (blocks[, meta])`]{#Pandoc}
1481−`Pandoc (blocks[, meta])`
1529+: A complete pandoc document
1483−A complete pandoc document
1531+ Parameters:
1485−Parameters:
1533+ `blocks`:
1487−`blocks`:
1536+ `meta`:
1488−: list of [Blocks]
1537+ : document meta data
1490−`meta`:
1539+## Meta {#meta}
1491−: [Meta] value (see below)
1493−## Metadata
1541+[`Meta (table)`]{#Meta}
1495−### Meta {#Meta}
1543+: Create a new Meta object.
1497−`Meta (table)`
1545+ Parameters:
1499−Create a new [Meta] object.
1547+ `table`:
1548+ : table containing document meta information
1501−Parameters:
1550+## MetaValue {#metavalue}
1503−`table`:
1552+[`MetaBlocks (blocks)`]{#MetaBlocks}
1504−: table with string keys and [MetaValue] values
1506−## MetaValue
1554+: Meta blocks
1508−### MetaBlocks {#MetaBlocks}
1556+ Parameters:
1510−`MetaBlocks (blocks)`
1558+ `blocks`:
1512−Block-level metadata content.
1561+[`MetaInlines (inlines)`]{#MetaInlines}
1514−Parameters:
1563+: Meta inlines
1516−`blocks`:
1565+ Parameters:
1519−### MetaInlines {#MetaInlines}
1567+ `inlines`:
1521−`MetaInlines (inlines)`
1570+[`MetaList (meta_values)`]{#MetaList}
1523−Inline-level metadata content.
1572+: Meta list
1525−Parameters:
1574+ Parameters:
1527−`inlines`:
1576+ `meta_values`:
1528−: list of [Inlines]
1577+ : list of meta values
1530−### MetaList {#MetaList}
1579+[`MetaMap (key_value_map)`]{#MetaMap}
1532−`MetaList (meta_values)`
1581+: Meta map
1534−List of metadata items.
1583+ Parameters:
1536−Parameters:
1585+ `key_value_map`:
1586+ : a string-indexed map of meta values
1538−`meta_values`:
1588+[`MetaString (str)`]{#MetaString}
1539−: list of [MetaValues][MetaValue]
1541−### MetaMap {#MetaMap}
1590+: Creates string to be used in meta data.
1543−`MetaMap (key_value_map)`
1592+ Parameters:
1545−Field/value map of metadata items.
1594+ `str`:
1547−Parameters:
1597+[`MetaBool (bool)`]{#MetaBool}
1549−`key_value_map`:
1599+: Creates boolean to be used in meta data.
1550−: a table with string keys and [MetaValue] values
1552−### MetaString {#MetaString}
1601+ Parameters:
1554−`MetaString (str)`
1603+ `bool`:
1556−String metadata content.
1606+## Blocks
1558−Parameters:
1608+[`Block`]{#Block}
1560−`str`:
1610+: Block elements
1563−### MetaBool {#MetaBool}
1612+[`BlockQuote (content)`]{#BlockQuote}
1565−`MetaBool (bool)`
1614+: Creates a block quote element
1567−Boolean metadata content.
1616+ Parameters:
1569−Parameters:
1618+ `content`:
1571−`bool`:
1621+ Returns: block quote element
1574−## Blocks {#Blocks}
1623+[`BulletList (content)`]{#BulletList}
1576−### BlockQuote {#BlockQuote}
1625+: Creates a bullet (i.e.
1578−`BlockQuote (content)`
1627+ Parameters:
1580−Creates a BlockQuote element
1629+ `content`:
1582−Parameters:
1632+ Returns: bullet list element
1584−`content`:
1634+[`CodeBlock (text[, attr])`]{#CodeBlock}
1587−Returns: BlockQuote element
1636+: Creates a code block element
1589−### BulletList {#BulletList}
1638+ Parameters:
1591−`BulletList (content)`
1640+ `text`:
1593−Creates a BulletList element
1643+ `attr`:
1644+ : element attributes
1595−Parameters:
1646+ Returns: code block element
1597−`content`:
1648+[`DefinitionList (content)`]{#DefinitionList}
1598−: list of items (where each item is a list of [Blocks])
1600−Returns: BulletList element
1650+: Creates a definition list, containing terms and their
1602−### CodeBlock {#CodeBlock}
1653+ Parameters:
1604−`CodeBlock (text[, attr])`
1655+ `content`:
1606−Creates a CodeBlock element
1658+ Returns: definition list element
1608−Parameters:
1660+[`Div (content[, attr])`]{#Div}
1610−`text`:
1662+: Creates a div element
1613−`attr`:
1664+ Parameters:
1614−: [Attr](#Attr) (code attributes)
1616−Returns: CodeBlock element
1666+ `content`:
1618−### DefinitionList {#DefinitionList}
1669+ `attr`:
1670+ : element attributes
1620−`DefinitionList (content)`
1672+ Returns: div element
1622−Creates a DefinitionList element
1674+[`Header (level, content[, attr])`]{#Header}
1624−Parameters:
1676+: Creates a header element.
1626−`content`:
1678+ Parameters:
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],
1632−Returns: DefinitionList element
1680+ `level`:
1634−### Div {#Div}
1683+ `content`:
1636−`Div (content[, attr])`
1686+ `attr`:
1687+ : element attributes
1638−Creates a Div element
1689+ Returns: header element
1640−Parameters:
1691+[`HorizontalRule ()`]{#HorizontalRule}
1642−`content`:
1693+: Creates a horizontal rule.
1645−`attr`:
1695+ Returns: horizontal rule
1646−: [Attr](#Attr) (Div attributes)
1648−Returns: Div element
1697+[`LineBlock (content)`]{#LineBlock}
1650−### Header {#Header}
1699+: Creates a line block element.
1652−`Header (level, content[, attr])`
1701+ Parameters:
1654−Creates a Header element.
1703+ `content`:
1656−Parameters:
1706+ Returns: line block element
1658−`level`:
1708+[`Null ()`]{#Null}
1659−: Header level (integer)
1661−`content`:
1710+: Creates a null element.
1662−: list of [Inlines] (header title)
1664−`attr`:
1712+ Returns: null element
1665−: [Attr](#Attr) (header attributes)
1667−Returns: Header element
1714+[`OrderedList (items[, listAttributes])`]{#OrderedList}
1669−### HorizontalRule {#HorizontalRule}
1716+: Creates an ordered list.
1671−`HorizontalRule ()`
1718+ Parameters:
1673−Creates a HorizontalRule element.
1720+ `items`:
1675−Returns: HorizontalRule element
1723+ `listAttributes`:
1677−### LineBlock {#LineBlock}
1726+ Returns: ordered list element
1679−`LineBlock (content)`
1728+[`Para (content)`]{#Para}
1681−Creates a LineBlock element.
1730+: Creates a para element.
1683−Parameters:
1732+ Parameters:
1685−`content`:
1734+ `content`:
1686−: list of lines (where each line is a list of [Inlines])
1735+ : inline content
1688−Returns: LineBlock element
1737+ Returns: paragraph element
1690−### Null {#Null}
1739+[`Plain (content)`]{#Plain}
1692−`Null ()`
1741+: Creates a plain element.
1694−Creates a Null block element.
1743+ Parameters:
1696−Returns: Null element
1745+ `content`:
1698−### OrderedList {#OrderedList}
1748+ Returns: plain element
1700−`OrderedList (items[, listAttributes])`
1750+[`RawBlock (format, text)`]{#RawBlock}
1702−Creates an OrderedList element.
1752+: Creates a raw content block of the specified format.
1704−Parameters:
1754+ Parameters:
1706−`items`:
1756+ `format`:
1707−: list of items (where each item is a list of [Blocks])
1757+ : format of content
1709−`listAttributes`:
1759+ `text`:
1710−: [ListAttributes]{#ListAttributes}
1760+ : string content
1712−Returns: OrderedList element
1762+ Returns: raw block element
1714−### Para {#Para}
1764+[`Table (caption, aligns, widths, headers, rows)`]{#Table}
1716−`Para (content)`
1766+: Creates a table element.
1718−Creates a Para element.
1768+ Parameters:
1720−Parameters:
1770+ `caption`:
1722−`content`:
1773+ `aligns`:
1723−: list of [Inlines]
1774+ : alignments
1725−Returns: Para element
1776+ `widths`:
1727−### Plain {#Plain}
1779+ `headers`:
1729−`Plain (content)`
1782+ `rows`:
1731−Creates a Plain element.
1785+ Returns: table element
1733−Parameters:
1787+## Inline {#inline}
1735−`content`:
1789+[`Inline`]{#Inline}
1738−Returns: Plain element
1791+: Inline element class
1740−### RawBlock {#RawBlock}
1793+[`Cite (content, citations)`]{#Cite}
1742−`RawBlock (format, text)`
1795+: Creates a Cite inline element
1744−Creates a RawBlock of the specified format.
1797+ Parameters:
1746−Parameters:
1799+ `content`:
1748−`format`:
1802+ `citations`:
1749−: string (format of content, e.g. 'latex')
1803+ : List of citations
1751−`text`:
1805+ Returns: citations element
1754−Returns: RawBlock element
1807+[`Code (text[, attr])`]{#Code}
1756−### Table {#Table}
1809+: Creates a Code inline element
1758−`Table (caption, aligns, widths, headers, rows)`
1811+ Parameters:
1760−Creates a Table element.
1813+ `text`:
1762−Parameters:
1816+ `attr`:
1817+ : additional attributes
1764−`caption`:
1819+ Returns: code element
1765−: table caption (list of [Inlines])
1767−`aligns`:
1821+[`Emph (content)`]{#Emph}
1768−: alignments (a list of
1769− `pandoc.AlignDefault`, `pandoc.AlignLeft`, `pandoc.AlignRight`,
1770− `pandoc.AlignCenter`, one for each column)
1772−`widths`:
1823+: Creates an inline element representing emphasised text.
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)
1778−`headers`:
1825+ Parameters:
1779−: header row (a list of cells, each cell a list of [Blocks])
1781−`rows`:
1827+ `content`:
1782−: table rows (a list of rows, each row a list of cells,
1828+ : inline content
1783− each cell a list of [Blocks])
1785−Returns: Table element
1830+ Returns: emphasis element
1787−## Inlines {#Inlines}
1832+[`Image (caption, src[, title[, attr]])`]{#Image}
1789−### Cite {#Cite}
1834+: Creates a Image inline element
1791−`Cite (content, citations)`
1836+ Parameters:
1793−Creates a Cite element
1838+ `caption`:
1839+ : text used to describe the image
1795−Parameters:
1841+ `src`:
1842+ : path to the image file
1797−`content`:
1844+ `title`:
1798−: list of [Inlines]
1845+ : brief image description
1800−`citations`:
1847+ `attr`:
1801−: list of [Citation]s
1848+ : additional attributes
1803−Returns: citations element
1850+ Returns: image element
1805−### Code {#Code}
1852+[`LineBreak ()`]{#LineBreak}
1807−`Code (text[, attr])`
1854+: Create a LineBreak inline element
1809−Creates a Code inline element
1856+ Returns: linebreak element
1811−Parameters:
1858+[`Link (content, target[, title[, attr]])`]{#Link}
1813−`text`:
1860+: Creates a link inline element, usually a hyperlink.
1816−`attr`:
1862+ Parameters:
1817−: [Attr](#Attr) (code attributes)
1819−Returns: Code element
1864+ `content`:
1865+ : text for this link
1821−### Emph {#Emph}
1867+ `target`:
1823−`Emph (content)`
1870+ `title`:
1871+ : brief link description
1825−Creates an Emph inline element
1873+ `attr`:
1874+ : additional attributes
1827−Parameters:
1876+ Returns: image element
1829−`content`:
1878+[`Math (mathtype, text)`]{#Math}
1832−Returns: Emph element
1880+: Creates a Math element, either inline or displayed.
1834−### Image {#Image}
1882+ Parameters:
1836−`Image (alt, src[, title[, attr]])`
1884+ `mathtype`:
1885+ : rendering specifier
1838−Creates a Image inline element
1887+ `text`:
1840−Parameters:
1890+ Returns: Math element
1842−`alt`:
1892+[`DisplayMath (text)`]{#DisplayMath}
1843−: list of [Inlines]: alt text (or, for implicit figures,
1846−`src`:
1894+: Creates a DisplayMath element (DEPRECATED).
1847−: string: path to the image file
1849−`title`:
1896+ Parameters:
1850−: string: title attribute
1852−`attr`:
1898+ `text`:
1853−: [Attr](#Attr): additional image attributes
1899+ : Math content
1855−Returns: Image element
1901+ Returns: Math element
1857−### LineBreak {#LineBreak}
1903+[`InlineMath (text)`]{#InlineMath}
1859−`LineBreak ()`
1905+: Creates an InlineMath inline element (DEPRECATED).
1861−Create a LineBreak inline element
1907+ Parameters:
1863−Returns: linebreak element
1909+ `text`:
1865−### Link {#Link}
1912+ Returns: Math element
1867−`Link (content, target[, title[, attr]])`
1914+[`Note (content)`]{#Note}
1869−Creates a Link inline element
1916+: Creates a Note inline element
1871−Parameters:
1918+ Parameters:
1873−`content`:
1920+ `content`:
1874−: list of [Inlines]: the linked text
1921+ : footnote block content
1876−`target`:
1923+[`Quoted (quotetype, content)`]{#Quoted}
1877−: string: the link target
1879−`title`:
1925+: Creates a Quoted inline element given the quote type and
1880−: string: the title attribute
1926+ quoted content.
1882−`attr`:
1928+ Parameters:
1883−: [Attr](#Attr): additional link attributes
1885−Returns: image element
1930+ `quotetype`:
1931+ : type of quotes to be used
1887−### Math {#Math}
1933+ `content`:
1889−`Math (mathtype, text)`
1936+ Returns: quoted element
1891−Creates a Math inline element, either inline or displayed.
1938+[`SingleQuoted (content)`]{#SingleQuoted}
1893−Parameters:
1940+: Creates a single-quoted inline element (DEPRECATED).
1895−`mathtype`:
1942+ Parameters:
1896−: either `pandoc.InlineMath` or `pandoc.DisplayMath`
1898−`text`:
1944+ `content`:
1899−: string: raw tex math
1945+ : inline content
1901−Returns: Math element
1947+ Returns: quoted element
1903−### DisplayMath {#DisplayMath}
1949+ See also: [Quoted](#Quoted)
1905−`DisplayMath (text)`
1951+[`DoubleQuoted (content)`]{#DoubleQuoted}
1907−Creates a DisplayMath element (DEPRECATED, use `Math`).
1953+: Creates a single-quoted inline element (DEPRECATED).
1909−Parameters:
1955+ Parameters:
1911−`text`:
1957+ `content`:
1912−: string: raw tex math
1958+ : inline content
1914−Returns: Math element
1960+ Returns: quoted element
1916−### InlineMath {#InlineMath}
1962+ See also: [Quoted](#Quoted)
1918−`InlineMath (text)`
1964+[`RawInline (format, text)`]{#RawInline}
1920−Creates an InlineMath inline element (DEPRECATED, use
1966+: Creates a RawInline inline element
1923−Parameters:
1968+ Parameters:
1925−`text`:
1970+ `format`:
1926−: string: raw tex math
1971+ : format of the contents
1928−Returns: Math element
1973+ `text`:
1930−### Note {#Note}
1976+ Returns: raw inline element
1932−`Note (content)`
1978+[`SmallCaps (content)`]{#SmallCaps}
1934−Creates a Note inline element
1980+: Creates text rendered in small caps
1936−Parameters:
1982+ Parameters:
1938−`content`:
1984+ `content`:
1939−: list of [Blocks] (content of footnote)
1985+ : inline content
1941−### Quoted {#Quoted}
1987+ Returns: smallcaps element
1943−`Quoted (quotetype, content)`
1989+[`SoftBreak ()`]{#SoftBreak}
1945−Creates a Quoted inline element
1991+: Creates a SoftBreak inline element.
1947−Parameters:
1993+ Returns: softbreak element
1949−`quotetype`:
1995+[`Space ()`]{#Space}
1950−: either `pandoc.DoubleQuote` or `pandoc.SingleQuote`
1952−`content`:
1997+: Create a Space inline element
1955−Returns: Quoted element
1999+ Returns: space element
1957−### SingleQuoted {#SingleQuoted}
2001+[`Span (content[, attr])`]{#Span}
1959−`SingleQuoted (content)`
2003+: Creates a Span inline element
1961−Creates a single-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2005+ Parameters:
1963−Parameters:
2007+ `content`:
1965−`content`:
2010+ `attr`:
1966−: list of [Inlines]
2011+ : additional attributes
1968−Returns: Quoted element
2013+ Returns: span element
1970−### DoubleQuoted {#DoubleQuoted}
2015+[`Str (text)`]{#Str}
1972−`DoubleQuoted (content)`
2017+: Creates a Str inline element
1974−Creates a double-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2019+ Parameters:
1976−Parameters:
2021+ `text`:
1978−`content`:
2024+ Returns: string element
1981−Returns: Quoted element
2026+[`Strikeout (content)`]{#Strikeout}
1983−### RawInline {#RawInline}
2028+: Creates text which is striked out.
1985−`RawInline (format, text)`
2030+ Parameters:
1987−Creates a RawInline inline element
2032+ `content`:
1989−Parameters:
2035+ Returns: strikeout element
1991−`format`:
2037+[`Strong (content)`]{#Strong}
1992−: string (format of the contents)
1994−`text`:
2039+: Creates a Strong element, whose text is usually displayed in
1995−: string (content)
2040+ a bold font.
1997−Returns: RawInline element
2042+ Parameters:
1999−### Smallcaps {#SmallCaps}
2044+ `content`:
2001−`SmallCaps (content)`
2047+ Returns: strong element
2003−Creates text rendered in small caps
2049+[`Subscript (content)`]{#Subscript}
2005−Parameters:
2051+: Creates a Subscript inline element
2007−`content`:
2053+ Parameters:
2010−Returns: SmallCaps element
2055+ `content`:
2012−### SoftBreak {#SoftBreak}
2058+ Returns: subscript element
2014−`SoftBreak ()`
2060+[`Superscript (content)`]{#Superscript}
2016−Creates a SoftBreak inline element.
2062+: Creates a Superscript inline element
2018−Returns: SoftBreak element
2064+ Parameters:
2020−### Space {#Space}
2066+ `content`:
2022−`Space ()`
2069+ Returns: strong element
2024−Create a Space inline element
2071+## Element components {#element-components}
2026−Returns: Space element
2073+[`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
2028−### Span {#Span}
2075+: Create a new set of attributes (Attr).
2030−`Span (content[, attr])`
2077+ Parameters:
2032−Creates a Span inline element
2079+ `identifier`:
2080+ : element identifier
2034−Parameters:
2082+ `classes`:
2036−`content`:
2085+ `attributes`:
2037−: list of [Inlines]
2086+ : table containing string keys and values
2040−: [Attr](#Attr): span attributes
2088+ Returns: element attributes
2042−Returns: Span element
2090+[`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`]{#Citation}
2044−### Str {#Str}
2092+: Creates a single citation.
2046−`Str (text)`
2094+ Parameters:
2048−Creates a Str inline element
2096+ `id`:
2097+ : citation identifier (like a bibtex key)
2050−Parameters:
2099+ `mode`:
2052−`text`:
2102+ `prefix`:
2053−: string
2103+ : citation prefix
2055−Returns: String element
2105+ `suffix`:
2057−### Strikeout {#Strikeout}
2108+ `note_num`:
2059−`Strikeout (content)`
2111+ `hash`:
2061−Creates a Strikeout inline element
2114+[`ListAttributes ([start[, style[, delimiter]]])`]{#ListAttributes}
2063−Parameters:
2116+: Creates a set of list attributes.
2065−`content`:
2118+ Parameters:
2068−Returns: Strikeout element
2120+ `start`:
2121+ : number of the first list item
2070−### Strong {#Strong}
2123+ `style`:
2124+ : style used for list numbering
2072−`Strong (content)`
2126+ `delimiter`:
2127+ : delimiter of list numbers
2074−Creates a Strong inline element.
2129+ Returns: list attributes table
2076−Parameters:
2131+## Constants
2078−`content`:
2133+[`AuthorInText`]{#AuthorInText}
2081−Returns: Strong element
2135+: Author name is mentioned in the text.
2083−### Subscript {#Subscript}
2137+ See also: [Citation](#Citation)
2085−`Subscript (content)`
2139+[`SuppressAuthor`]{#SuppressAuthor}
2087−Creates a Subscript inline element
2141+: Author name is suppressed.
2089−Parameters:
2143+ See also: [Citation](#Citation)
2091−`content`:
2145+[`NormalCitation`]{#NormalCitation}
2094−Returns: Subscript element
2147+: Default citation style is used.
2096−### Superscript {#Superscript}
2149+ See also: [Citation](#Citation)
2098−`Superscript (content)`
2151+[`AlignLeft`]{#AlignLeft}
2100−Creates a Superscript inline element
2153+: Table cells aligned left.
2102−Parameters:
2155+ See also: [Table](#Table)
2104−`content`:
2157+[`AlignRight`]{#AlignRight}
2107−Returns: Superscript element
2159+: Table cells right-aligned.
2109−## Element components
2161+ See also: [Table](#Table)
2111−### Attr {#Attr}
2163+[`AlignCenter`]{#AlignCenter}
2113−`Attr ([identifier[, classes[, attributes]]])`
2165+: Table cell content is centered.
2115−Create a new set of attributes (Attr).
2167+ See also: [Table](#Table)
2117−Parameters:
2169+[`AlignDefault`]{#AlignDefault}
2119−`identifier`:
2171+: Table cells are alignment is unaltered.
2120−: string: element identifier
2122−`classes`:
2173+ See also: [Table](#Table)
2123−: list of strings: classes
2125−`attributes`:
2175+[`DefaultDelim`]{#DefaultDelim}
2126−: table containing string keys and values
2128−Returns: Attr
2177+: Default list number delimiters are used.
2130−### Citation {#Citation}
2179+ See also: [OrderedList](#OrderedList)
2132−`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`
2181+[`Period`]{#Period}
2134−Creates a single Citation.
2183+: List numbers are delimited by a period.
2136−Parameters:
2185+ See also: [OrderedList](#OrderedList)
2138−`id`:
2187+[`OneParen`]{#OneParen}
2139−: string citation identifier (like a bibtex key)
2141−`mode`:
2189+: List numbers are delimited by a single parenthesis.
2142−: `pandoc.AuthorInText`, `pandoc.SuppressAuthor`, or
2143− `pandoc.NormalCitation`
2145−`prefix`:
2191+ See also: [OrderedList](#OrderedList)
2146−: list of [Inlines] for citation prefix
2148−`suffix`:
2193+[`TwoParens`]{#TwoParens}
2149−: list of [Inlines] for citation suffix
2151−`note_num`:
2195+: List numbers are delimited by a double parentheses.
2154−`hash`:
2197+ See also: [OrderedList](#OrderedList)
2157−### ListAttributes {#ListAttributes}
2199+[`DefaultStyle`]{#DefaultStyle}
2159−`ListAttributes ([start[, style[, delimiter]]])`
2201+: List are numbered in the default style
2161−Creates a set of list attributes
2203+ See also: [OrderedList](#OrderedList)
2163−Parameters:
2205+[`Example`]{#Example}
2207+: List items are numbered as examples.
2209+ See also: [OrderedList](#OrderedList)
2211+[`Decimal`]{#Decimal}
2213+: List are numbered using decimal integers.
2215+ See also: [OrderedList](#OrderedList)
2217+[`LowerRoman`]{#LowerRoman}
2165−`start`:
2219+: List are numbered using lower-case roman numerals.
2166−: int: number of the first list item (default: 1)
2168−`style`:
2221+ See also: [OrderedList](#OrderedList)
2169−: `pandoc.DefaultStyle` (default), `pandoc.Decimal`,
2170− `pandoc.LowerRoman`, `pandoc.UpperRoman`, `pandoc.LowerAlpha`,
2171− or `pandoc.UpperAlpha`
2173−`delimiter`:
2223+[`UpperRoman`]{#UpperRoman}
2174−: `pandoc.DefaultDelim` (default), `pandoc.Period`,
2175− `pandoc.OneParen`, `pandoc.TwoParens`
2177−Returns: list attributes table
2225+: List are numbered using upper-case roman numerals
2227+ See also: [OrderedList](#OrderedList)
2229+[`LowerAlpha`]{#LowerAlpha}
2231+: List are numbered using lower-case alphabetic characters.
2233+ See also: [OrderedList](#OrderedList)
2235+[`UpperAlpha`]{#UpperAlpha}
2237+: List are numbered using upper-case alphabetic characters.
2239+ See also: [OrderedList](#OrderedList)
2243+: Functions which have moved to different modules
2179## Helper functions
2245## Helper functions
2181−### pipe {#pipe}
2247+### pipe
2183`pipe (command, args, input)`
2249`pipe (command, args, input)`
2185−Runs command with arguments, passing it some input, and
2251+Runs command with arguments, passing it some input, and returns
2186−returns the output.
2252+the output.
@@ -2199,7 +2265,7 @@ Usage:
2200 local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
2266 local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
2202−### walk_block {#walk_block}
2268+### walk\_block
2204`walk_block (element, filter)`
2270`walk_block (element, filter)`
@@ -2211,17 +2277,16 @@ Parameters:
2211: the block element
2277: the block element
2213`filter`:
2279`filter`:
2214−: a lua filter (table of functions) to be applied within
2280+: a lua filter (table of functions) to be applied within the
2215− the block element
2281+ block element
2217Returns: the transformed block element
2283Returns: the transformed block element
2219−### walk_inline {#walk_inline}
2285+### walk\_inline
2221`walk_inline (element, filter)`
2287`walk_inline (element, filter)`
2223−Apply a filter inside an inline element, walking its
2289+Apply a filter inside an inline element, walking its contents.
2226Parameters:
2291Parameters:
@@ -2229,12 +2294,12 @@ Parameters:
2229: the inline element
2294: the inline element
2231`filter`:
2296`filter`:
2232−: a lua filter (table of functions) to be applied within
2297+: a lua filter (table of functions) to be applied within the
2233− the inline element
2298+ inline element
2235Returns: the transformed inline element
2300Returns: the transformed inline element
2237−### read {#read}
2302+### read
2239`read (markup[, format])`
2304`read (markup[, format])`
@@ -2259,15 +2324,14 @@ Usage:
2259 -- The inline element in that block is an `Emph`
2324 -- The inline element in that block is an `Emph`
2260 assert(block.content[1].t == "Emph")
2325 assert(block.content[1].t == "Emph")
2263# Module pandoc.utils
2327# Module pandoc.utils
2265This module exposes internal pandoc functions and utility
2329This module exposes internal pandoc functions and utility
2266functions.
2330functions.
2268−The module is loaded as part of the `pandoc` module and available
2332+The module is loaded as part of the `pandoc` module and
2269−as `pandoc.utils`. In versions up-to and including pandoc 2.6,
2333+available as `pandoc.utils`. In versions up-to and including
2270−this module had to be loaded explicitly. Example:
2334+pandoc 2.6, this module had to be loaded explicitly. Example:
2272 local utils = require 'pandoc.utils'
2336 local utils = require 'pandoc.utils'
@@ -2282,16 +2346,16 @@ Squash a list of blocks into a list of inlines.
2282Parameters:
2346Parameters:
2284`blocks`:
2348`blocks`:
2285−: List of [Blocks] to be flattened.
2349+: List of [Blocks](#Blocks) to be flattened.
2288−: List of [Inlines] inserted as separator between two
2352+: List of [Inlines](#Inlines) inserted as separator between
2289− consecutive blocks; defaults to `{ pandoc.Space(),
2353+ two consecutive blocks; defaults to
2290− pandoc.Str'¶', pandoc.Space()}`.
2354+ `{ pandoc.Space(), pandoc.Str'¶', pandoc.Space()}`.
2294−- List of [Inlines]
2358+- List of [Inlines](#Inlines)
@@ -2319,30 +2383,26 @@ Parameters:
2319`element1`, `element2`:
2383`element1`, `element2`:
2320: Objects to be compared. Acceptable input types are
2384: Objects to be compared. Acceptable input types are
2321 [Pandoc](#type-ref-pandoc), [Meta](#type-ref-meta),
2385 [Pandoc](#type-ref-pandoc), [Meta](#type-ref-meta),
2322− [MetaValue](#type-ref-MetaValue),
2386+ [MetaValue](#type-ref-MetaValue), [Block](#type-ref-Block),
2323− [Block](#type-ref-Block), [Inline](#type-ref-Inline),
2324− [Attr](#type-ref-Attr),
2387+ [Inline](#type-ref-Inline), [Attr](#type-ref-Attr),
2325 [ListAttributes](#type-ref-ListAttributes), and
2388 [ListAttributes](#type-ref-ListAttributes), and
2326 [Citation](#type-ref-Citation).
2389 [Citation](#type-ref-Citation).
2330−- Whether the two objects represent the same element
2393+- Whether the two objects represent the same element (boolean)
2333### hierarchicalize {#utils-hierarchicalize}
2395### hierarchicalize {#utils-hierarchicalize}
2335`hierarchicalize (blocks)`
2397`hierarchicalize (blocks)`
2337−Convert list of [Blocks] into an hierarchical list. An
2399+Convert list of [Blocks](#Blocks) into an hierarchical list. An
2338−hierarchical elements is either a normal block (but no
2400+hierarchical elements is either a normal block (but no Header),
2339−Header), or a `Sec` element. The latter has the following
2401+or a `Sec` element. The latter has the following fields:
2342- level: level in the document hierarchy;
2403- level: level in the document hierarchy;
2343−- numbering: list of integers of length `level`,
2404+- numbering: list of integers of length `level`, specifying
2344− specifying the absolute position of the section in the
2405+ the absolute position of the section in the document;
2346- attr: section attributes (see [Attr](#Attr));
2406- attr: section attributes (see [Attr](#Attr));
2347- contents: nested list of hierarchical elements.
2407- contents: nested list of hierarchical elements.
@@ -2393,14 +2453,14 @@ Usage:
2394 some_blocks = sub_doc.blocks -- some blocks with bib
2454 some_blocks = sub_doc.blocks -- some blocks with bib
2396−### normalize_date {#utils-normalize_date}
2456+### normalize\_date {#utils-normalize_date}
2398`normalize_date (date_string)`
2458`normalize_date (date_string)`
2400−Parse a date and convert (if possible) to "YYYY-MM-DD"
2460+Parse a date and convert (if possible) to "YYYY-MM-DD" format.
2401−format. We limit years to the range 1601-9999 (ISO 8601
2461+We limit years to the range 1601-9999 (ISO 8601 accepts greater
2402−accepts greater than or equal to 1583, but MS Word only
2462+than or equal to 1583, but MS Word only accepts dates starting
2403−accepts dates starting 1601).
2463+1601).
@@ -2424,8 +2484,8 @@ Usage:
2425`stringify (element)`
2485`stringify (element)`
2427−Converts the given element (Pandoc, Meta, Block, or Inline)
2487+Converts the given element (Pandoc, Meta, Block, or Inline) into
2428−into a string with all formatting removed.
2488+a string with all formatting removed.
@@ -2459,9 +2519,9 @@ The `pandoc.mediabag` module allows accessing pandoc's media
2459storage. The "media bag" is used when pandoc is called with the
2519storage. The "media bag" is used when pandoc is called with the
2460`--extract-media` or `--standalone`/`-s` option.
2520`--extract-media` or `--standalone`/`-s` option.
2462−The module is loaded as part of module `pandoc` and can either be
2522+The module is loaded as part of module `pandoc` and can either
2463−accessed via the `pandoc.mediabag` field, or explicitly required,
2523+be accessed via the `pandoc.mediabag` field, or explicitly
2464−e.g.:
2524+required, e.g.:
2466 local mb = require 'pandoc.mediabag'
2526 local mb = require 'pandoc.mediabag'
@@ -2522,11 +2582,11 @@ including their contents, is required. For all other cases,
2525− - The iterator function; must be called with the iterator state
2585+- The iterator function; must be called with the iterator
2526− and the current iterator value.
2586+ state and the current iterator value.
2527− - Iterator state – an opaque value to be passed to the iterator
2587+- Iterator state -- an opaque value to be passed to the
2528− function.
2588+ iterator function.
2529− - Initial iterator value.
2589+- Initial iterator value.
@@ -2540,10 +2600,10 @@ Usage:
2541Get a summary of the current media bag contents.
2601Get a summary of the current media bag contents.
2543−Returns: A list of elements summarizing each entry in the
2603+Returns: A list of elements summarizing each entry in the media
2544−media bag. The summary item contains the keys `path`,
2604+bag. The summary item contains the keys `path`, `type`, and
2545−`type`, and `length`, giving the filepath, MIME type, and
2605+`length`, giving the filepath, MIME type, and length of contents
2546−length of contents in bytes, respectively.
2606+in bytes, respectively.
@@ -2581,9 +2641,9 @@ Usage:
2582`fetch (source, base_url)`
2642`fetch (source, base_url)`
2584−Fetches the given source from a URL or local file. Returns
2644+Fetches the given source from a URL or local file. Returns two
2585−two values: the contents of the file and the MIME type (or
2645+values: the contents of the file and the MIME type (or an empty
2586−an empty string).
2646+string).
@@ -2595,135 +2655,108 @@ Usage:
2595 local diagram_url = "https://pandoc.org/diagram.jpg"
2655 local diagram_url = "https://pandoc.org/diagram.jpg"
2596 local contents = pandoc.mediabag.fetch(diagram_url, ".")
2656 local contents = pandoc.mediabag.fetch(diagram_url, ".")
2599# Module pandoc.List
2658# Module pandoc.List
2601−Pandoc's List type and helper methods.
2660+Pandoc\'s List type and helper methods
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:
2607− local List = require 'pandoc.List'
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.
2613## Metamethods
2662## Metamethods
2615−### concat {#pandoc.List:__concat}
2664+[`pandoc.List:__concat (list)`]{#pandoc.List:__concat}
2617−`pandoc.List:__concat (list)`
2666+: Concatenates two lists.
2619−Concatenates two lists.
2668+ Parameters:
2621−Parameters:
2670+ `list`:
2671+ : second list concatenated to the first
2624−: second list concatenated to the first
2626−Returns: a new list containing all elements from list1 and
2673+ Returns: a new list containing all elements from list1 and
2629## Methods
2676## Methods
2631−### clone {#pandoc.List:clone}
2633−`pandoc.List:clone ()` {#pandoc.List:clone}
2678+[`pandoc.List:clone ()`]{#pandoc.List:clone}
2635−Returns a (shallow) copy of the list.
2680+: Returns a (shallow) copy of the list.
2637−### includes {#pandoc.List:includes}
2682+[`pandoc.List:includes (needle, init)`]{#pandoc.List:includes}
2639−`pandoc.List:includes (needle, init)`
2684+: Checks if the list has an item equal to the given needle.
2641−Checks if the list has an item equal to the given needle.
2643−Parameters:
2686+ Parameters:
2645−`needle`:
2688+ `needle`:
2646−: item to search for
2689+ : item to search for
2648−`init`:
2691+ `init`:
2649−: index at which the search is started
2692+ : index at which the search is started
2651−Returns: true if a list item is equal to the needle, false
2694+ Returns: true if a list item is equal to the needle, false
2652−otherwise
2695+ otherwise
2654−### find {#pandoc.List:find}
2697+[`pandoc.List:find (needle, init)`]{#pandoc.List:find}
2656−`pandoc.List:find (needle, init)`
2699+: Returns the value and index of the first occurrence of the
2658−Returns the value and index of the first occurrence of the
2702+ Parameters:
2661−Parameters:
2704+ `needle`:
2705+ : item to search for
2663−`needle`:
2707+ `init`:
2664−: item to search for
2708+ : index at which the search is started
2666−`init`:
2710+ Returns: first item equal to the needle, or nil if no such
2667−: index at which the search is started
2711+ item exists.
2669−Returns: first item equal to the needle, or nil if no such
2713+[`pandoc.List:find_if (pred, init)`]{#pandoc.List:find_if}
2672−### find_if {#pandoc.List:find_if}
2715+: Returns the value and index of the first element for which
2716+ the predicate holds true.
2674−`pandoc.List:find_if (pred, init)`
2718+ Parameters:
2676−Returns the value and index of the first element for which
2720+ `pred`:
2677−the predicate holds true.
2721+ : the predicate function
2679−Parameters:
2723+ `init`:
2724+ : index at which the search is started
2681−`pred`:
2726+ Returns: first item for which \`test\` succeeds, or nil if
2682−: the predicate function
2727+ no such item exists.
2684−`init`:
2729+[`pandoc.List:extend (list)`]{#pandoc.List:extend}
2685−: index at which the search is started
2687−Returns: first item for which \`test\` succeeds, or nil if
2731+: Adds the given list to the end of this list.
2688−no such item exists.
2690−### extend {#pandoc.List:extend}
2733+ Parameters:
2692−`pandoc.List:extend (list)`
2735+ `list`:
2694−Adds the given list to the end of this list.
2738+[`pandoc.List:map (fn)`]{#pandoc.List:map}
2696−Parameters:
2740+: Returns a copy of the current list by applying the given
2741+ function to all elements.
2698−`list`:
2743+ Parameters:
2701−### map {#pandoc.List:map}
2745+ `fn`:
2746+ : function which is applied to all list items.
2703−`pandoc.List:map (fn)`
2748+[`pandoc.List:filter (pred)`]{#pandoc.List:filter}
2705−Returns a copy of the current list by applying the given
2750+: Returns a new list containing all items satisfying a given
2706−function to all elements.
2751+ condition.
2708−Parameters:
2753+ Parameters:
2711−: function which is applied to all list items.
2756+ : condition items must satisfy.
2713−### filter {#pandoc.List:filter}
2715−`pandoc.List:filter (pred)`
2717−Returns a new list containing all items satisfying a given
2723−: condition items must satisfy.
2725−Returns: a new list containing all items for which \`test\`
2758+ Returns: a new list containing all items for which \`test\`
2726−was true.
2759+ was true.
2728# Module pandoc.system
2761# Module pandoc.system
@@ -2749,8 +2782,8 @@ Retrieve the entire environment as a string-indexed table.
2752−- A table mapping environment variables names to their string value
2785+- A table mapping environment variables names to their string
2753− (table).
2786+ value (table).
2755### get\_working\_directory {#system-get_working_directory}
2788### get\_working\_directory {#system-get_working_directory}
@@ -2760,7 +2793,7 @@ Obtain the current working directory as an absolute path.
2763−- The current working directory (string).
2796+- The current working directory (string).
2765### with\_environment {#system-with_environment}
2798### with\_environment {#system-with_environment}
@@ -2796,16 +2829,16 @@ The directory is deleted after the callback returns.
2796Parameters:
2829Parameters:
2798`parent_dir`
2831`parent_dir`
2799−: Parent directory to create the directory in (string). If this
2832+: Parent directory to create the directory in (string). If
2800− parameter is omitted, the system's canonical temporary
2833+ this parameter is omitted, the system's canonical temporary
2801 directory is used.
2834 directory is used.
2804: Directory name template (string).
2837: Directory name template (string).
2806`callback`
2839`callback`
2807−: Function which takes the name of the temporary directory as its
2840+: Function which takes the name of the temporary directory as
2808− first argument (function).
2841+ its first argument (function).
@@ -2833,7 +2866,6 @@ Returns:
2834- The result(s) of the call to `callback`
2867- The result(s) of the call to `callback`
2837# Module pandoc.types
2869# Module pandoc.types
2839Constructors for types which are not part of the pandoc AST.
2871Constructors for types which are not part of the pandoc AST.