pandoc

AlignCenter

string

Table cell content is centered.

AlignDefault

string

Table cells are alignment is unaltered.

AlignLeft

string

Table cells aligned left.

AlignRight

string

Table cells right-aligned.

Attr

A set of element attributes. Values of this type can be created with the pandoc.Attr constructor. For convenience, it is usually not necessary to construct the value directly if it is part of an element, and it is sufficient to pass an HTML-like table. E.g., to create a span with identifier “text” and classes “a” and “b”, one can write:

local span = pandoc.Span('text', {id = 'text', class = 'a b'})

This also works when using the attr setter:

local span = pandoc.Span 'text'
span.attr = {id = 'text', class = 'a b', other_attribute = '1'}

Attr values are equal in Lua if and only if they are equal in Haskell.

Attr

pandoc.Attr

A set of element attributes. Values of this type can be created with the pandoc.Attr constructor. For convenience, it is usually not necessary to construct the value directly if it is part of an element, and it is sufficient to pass an HTML-like table. E.g., to create a span with identifier “text” and classes “a” and “b”, one can write:

local span = pandoc.Span('text', {id = 'text', class = 'a b'})

This also works when using the attr setter:

local span = pandoc.Span 'text'
span.attr = {id = 'text', class = 'a b', other_attribute = '1'}

Attr values are equal in Lua if and only if they are equal in Haskell.

clone

(method) pandoc.Attr:clone()
  -> pandoc.Attr

Make a clone

AuthorInText

string

Author name is mentioned in the text.

Block

Block element

clone

(method) pandoc.Block:clone()
  -> pandoc.Block

Make a clone

walk

(method) pandoc.Block:walk(lua_filter: table<string, function>)
  -> pandoc.Block

Apply a Lua filter

BlockQuote

pandoc.BlockQuote

A block quote element

BlockQuote

A block quote element

clone

(method) pandoc.BlockQuote:clone()
  -> pandoc.BlockQuote

Make a clone

walk

(method) pandoc.BlockQuote:walk(lua_filter: table<string, function>)
  -> pandoc.BlockQuote

Apply a Lua filter

Blocks

pandoc.Blocks

List of Block elements, with the same methods as a generic List, but also supporting a walk method.

Blocks

List of Block elements, with the same methods as a generic List, but also supporting a walk method.

BulletList

pandoc.BulletList

A bullet list

BulletList

A bullet list

clone

(method) pandoc.BulletList:clone()
  -> pandoc.BulletList

Make a clone

walk

(method) pandoc.BulletList:walk(lua_filter: table<string, function>)
  -> pandoc.BulletList

Apply a Lua filter

Caption

pandoc.Caption

The caption of a table, with an optional short caption.

Caption

The caption of a table, with an optional short caption.

clone

(method) pandoc.Caption:clone()
  -> pandoc.Caption

Make a clone

Cell

A table cell.

Cell

pandoc.Cell

A table cell.

clone

(method) pandoc.Cell:clone()
  -> pandoc.Cell

Make a clone

Chunk

pandoc.Chunk

Part of a document; usually chunks are each written to a separate file.

Chunk

Part of a document; usually chunks are each written to a separate file.

ChunkedDoc

pandoc.ChunkedDoc

A Pandoc document divided into Chunks.

The table of contents info in field toc is rose-tree structure represented as a list. The node item is always placed at index 0; subentries make up the rest of the list. Each node item contains the fields title ([Inlines][]), number (string|nil), id (string), path (string), and level (integer).

ChunkedDoc

A Pandoc document divided into Chunks.

The table of contents info in field toc is rose-tree structure represented as a list. The node item is always placed at index 0; subentries make up the rest of the list. Each node item contains the fields title ([Inlines][]), number (string|nil), id (string), path (string), and level (integer).

Citation

Single citation entry

Citation values are equal in Lua if and only if they are equal in Haskell.

Citation

pandoc.Citation

Single citation entry

Citation values are equal in Lua if and only if they are equal in Haskell.

clone

(method) pandoc.Citation:clone()
  -> pandoc.Citation

Make a clone

Cite

Citation

Cite

pandoc.Cite

Citation

clone

(method) pandoc.Cite:clone()
  -> pandoc.Cite

Make a clone

Code

pandoc.Code

Inline code

Code

Inline code

clone

(method) pandoc.Code:clone()
  -> pandoc.Code

Make a clone

CodeBlock

pandoc.CodeBlock

Block of code

CodeBlock

Block of code

clone

(method) pandoc.CodeBlock:clone()
  -> pandoc.CodeBlock

Make a clone

walk

(method) pandoc.CodeBlock:walk(lua_filter: table<string, function>)
  -> pandoc.CodeBlock

Apply a Lua filter

ColSpec

Column alignment and width specification for a single table column.

– This is a pair, i.e., a plain table, with the following – components:

– 1. cell alignment – 2. table column width, as a fraction of the page width

ColSpec

pandoc.ColSpec

Column alignment and width specification for a single table column.

– This is a pair, i.e., a plain table, with the following – components:

– 1. cell alignment – 2. table column width, as a fraction of the page width

CommonState

The state shared by all readers and writers. It is used by pandoc to collect and pass information.

Decimal

string

List are numbered using decimal integers.

DefaultDelim

string

Default list number delimiters are used.

DefaultStyle

string

List are numbered in the default style

DefinitionList

pandoc.DefinitionList

Definition list, containing terms and their explanation.

DefinitionList

Definition list, containing terms and their explanation.

clone

(method) pandoc.DefinitionList:clone()
  -> pandoc.DefinitionList

Make a clone

walk

(method) pandoc.DefinitionList:walk(lua_filter: table<string, function>)
  -> pandoc.DefinitionList

Apply a Lua filter

Div

pandoc.Div

Generic block container with attributes.

Div

Generic block container with attributes.

clone

(method) pandoc.Div:clone()
  -> pandoc.Div

Make a clone

walk

(method) pandoc.Div:walk(lua_filter: table<string, function>)
  -> pandoc.Div

Apply a Lua filter

Doc

Pandoc reflowable document: https://pandoc.org/lua-filters.html#type-doc

TODO: write fields and methods

Emph

Emphasized text

Emph

pandoc.Emph

Emphasized text

clone

(method) pandoc.Emph:clone()
  -> pandoc.Emph

Make a clone

Example

string

List items are numbered as examples.

Figure

Figure with caption and arbitrary block contents.

Figure

pandoc.Figure

Figure with caption and arbitrary block contents.

FormatExtensions

Header

Header element

clone

(method) pandoc.Header:clone()
  -> pandoc.Header

Make a clone

walk

(method) pandoc.Header:walk(lua_filter: table<string, function>)
  -> pandoc.Header

Apply a Lua filter

HorizontalRule

pandoc.HorizontalRule

A horizontal rule

HorizontalRule

A horizontal rule

clone

(method) pandoc.HorizontalRule:clone()
  -> pandoc.HorizontalRule

Make a clone

walk

(method) pandoc.HorizontalRule:walk(lua_filter: table<string, function>)
  -> pandoc.HorizontalRule

Apply a Lua filter

Image

Image: alt text (list of inlines), target

Image

pandoc.Image

Image: alt text (list of inlines), target

clone

(method) pandoc.Image:clone()
  -> pandoc.Image

Make a clone

Inline

Inline element

clone

(method) pandoc.Inline:clone()
  -> pandoc.Inline

Make a clone

Inlines

pandoc.Inlines

List of Inline elements, with the same methods as a generic List, but also supporting a walk method.

Inlines

List of Inline elements, with the same methods as a generic List, but also supporting a walk method.

LineBlock

pandoc.LineBlock

A line block, i.e. a list of lines, each separated from the next by a newline.

LineBlock

A line block, i.e. a list of lines, each separated from the next by a newline.

clone

(method) pandoc.LineBlock:clone()
  -> pandoc.LineBlock

Make a clone

walk

(method) pandoc.LineBlock:walk(lua_filter: table<string, function>)
  -> pandoc.LineBlock

Apply a Lua filter

LineBreak

pandoc.LineBreak

Hard line break

LineBreak

Hard line break

clone

(method) pandoc.LineBreak:clone()
  -> pandoc.LineBreak

Make a clone

clone

(method) pandoc.Link:clone()
  -> pandoc.Link

Make a clone

List

pandoc.List

List

at

(method) pandoc.List:at(index: integer, default?: any)
  -> any

Returns the element at the given index, or default if the list contains no item at the given position.

Negative integers count back from the last item in the list.

clone

(method) pandoc.List:clone()
  -> pandoc.List

Returns a (shallow) copy of the list. (To get a deep copy of the list, use walk with an empty filter.)

extend

(method) pandoc.List:extend(list: pandoc.List)
  -> pandoc.List

Adds the given list to the end of this list.

filter

(method) pandoc.List:filter(pred: fun(x: any):boolean)
  -> pandoc.List

Returns a new list containing all items satisfying a given condition.

find

(method) pandoc.List:find(needle: any, init?: integer)
  -> any
  2. integer

Returns the value and index of the first occurrence of the given item.

find_if

(method) pandoc.List:find_if(pred: fun(x: any):boolean, init?: integer)
  -> any
  2. integer|nil

Returns the value and index of the first element for which the predicate holds true.

includes

(method) pandoc.List:includes(needle: any, init?: integer)
  -> boolean

Checks if the list has an item equal to the given needle.

insert

(method) pandoc.List:insert(value: any)

Inserts element at end of list

iter

(method) pandoc.List:iter(step?: integer)
  -> function

Create an iterator over the list. The resulting function returns the next value each time it is called.

Usage:

for item in List{1, 1, 2, 3, 5, 8}:iter() do
  -- process item
end

map

(method) pandoc.List:map(fn: fun(x: any):any)
  -> pandoc.List

Returns a copy of the current list by applying the given function to all elements.

new

(method) pandoc.List:new(table?: function|table)
  -> pandoc.List

Create a new List. If the optional argument table is given, set the metatable of that value to pandoc.List.

The function also accepts an iterator, in which case it creates a new list from the return values of the iterator function.

remove

(method) pandoc.List:remove(pos?: integer)
  -> any

Removes the element at position pos, returning the value of the removed element.

sort

(method) pandoc.List:sort(comp?: fun(a: any, b: any):boolean)

Sorts list elements in a given order, in-place. If comp is given, then it must be a function that receives two list elements and returns true when the first element must come before the second in the final order (so that, after the sort, i < j implies not comp(list[j],list[i])). If comp is not given, then the standard Lua operator < is used instead.

Note that the comp function must define a strict partial order over the elements in the list; that is, it must be asymmetric and transitive. Otherwise, no valid sort may be possible.

The sort algorithm is not stable: elements considered equal by the given order may have their relative positions changed by the sort.

walk

(method) pandoc.List:walk(lua_filter: table<string, function>)
  -> pandoc.List

Applies a Lua filter to a list of Blocks or Inlines. Just as for full-document filters, the order in which elements are traversed can be controlled by setting the traverse field of the filter; Returns a (deep) copy on which the filter has been applied: the original list is left untouched.

Note that this method is only available for lists of blocks and inilines.

Usage:

-- returns `pandoc.Blocks{pandoc.Para('Salve!')}`
return pandoc.Blocks{pandoc.Plain('Salve!)}:walk {
  Plain = function (p) return pandoc.Para(p.content) end,
}

ListAttributes

pandoc.ListAttributes

List attributes

ListAttributes

List attributes

clone

(method) pandoc.ListAttributes:clone()
  -> pandoc.ListAttributes

Make a clone

LogMessage

A pandoc log message. Objects have no fields, but can be converted to a string via tostring.

LogMessage

pandoc.LogMessage

A pandoc log message. Objects have no fields, but can be converted to a string via tostring.

LowerAlpha

string

List are numbered using lower-case alphabetic characters.

LowerRoman

string

List are numbered using lower-case roman numerals.

Math

pandoc.Math

TeX math (literal)

Math

TeX math (literal)

clone

(method) pandoc.Math:clone()
  -> pandoc.Math

Make a clone

Meta

function pandoc.Meta(meta_table: table<string, boolean|string|number|pandoc.List|table<number, pandoc.MetaValue>...(+1)>)
  -> table<string, boolean|string|number|pandoc.List|table<number, pandoc.MetaValue>...(+1)>

Meta

Meta information on a document; string-indexed collection of meta values. Meta values are equal in Lua if and only if they are equal in Haskell.

MetaBlocks

MetaBlocks

function pandoc.MetaBlocks(blocks: pandoc.Blocks)
  -> pandoc.List

Creates a value to be used as a MetaBlocks value in meta data; creates a copy of the input list via pandoc.Blocks, discarding all non-list keys.

MetaBool

function pandoc.MetaBool(bool: boolean)
  -> boolean

Creates a value to be used as MetaBool in meta data; this is the identity function for boolean values and exists only for completeness.

MetaBool

MetaInlines

MetaInlines

function pandoc.MetaInlines(inlines: pandoc.Inlines)
  -> pandoc.List

Creates a value to be used as a MetaInlines value in meta data; creates a copy of the input list via pandoc.Inlines, discarding all non-list keys.

MetaList

function pandoc.MetaList(meta_values: table<number, boolean|string|number|pandoc.List|table<number, pandoc.MetaValue>...(+1)>)
  -> table<number, pandoc.MetaValue>

Creates a value to be used as a MetaList in meta data; creates a copy of the input list via pandoc.List, discarding all non-list keys.

MetaList

MetaMap

MetaMap

function pandoc.MetaMap(key_value_map: table<string, boolean|string|number|pandoc.List|table<number, pandoc.MetaValue>...(+1)>)
  -> table<string, pandoc.MetaValue>
  • Creates a value to be used as a MetaMap in meta data; creates – a copy of the input table, keeping only pairs with string – keys and discards all other keys.

MetaString

MetaString

function pandoc.MetaString(str: string|number)
  -> string|number

Creates a value to be used as a MetaString in meta data; this is the identity function for boolean values and exists only for completeness.

MetaValue

Node

Raw inline content of a specified format

NormalCitation

string

Default citation style is used.

Note

pandoc.Note

Footnote or endnote

Note

Footnote or endnote

clone

(method) pandoc.Note:clone()
  -> pandoc.Note

Make a clone

OneParen

string

List numbers are delimited by a single parenthesis.

OrderedList

An ordered list.

OrderedList

pandoc.OrderedList

An ordered list.

clone

(method) pandoc.OrderedList:clone()
  -> pandoc.OrderedList

Make a clone

walk

(method) pandoc.OrderedList:walk(lua_filter: table<string, function>)
  -> pandoc.OrderedList

Apply a Lua filter

Pandoc

Pandoc document

Values of this type can be created with thepandoc.Pandoc constructor. Pandoc values are equal in Lua if and only if they are equal in Haskell.

Pandoc

pandoc.Pandoc

Pandoc document

Values of this type can be created with thepandoc.Pandoc constructor. Pandoc values are equal in Lua if and only if they are equal in Haskell.

clone

(method) pandoc.Pandoc:clone()
  -> pandoc.Pandoc

Make a clone

walk

(method) pandoc.Pandoc:walk(lua_filter: table<string, function>)
  -> pandoc.Pandoc

Applies a Lua filter to the Pandoc element. Just as for full-document filters, the order in which elements are traversed can be controlled by setting the traverse field of the filter; see the section on [traversal order][Traversal order]. Returns a (deep) copy on which the filter has been applied: the original element is left untouched.

Usage:

-- returns `pandoc.Pandoc{pandoc.Para{pandoc.Str 'Bye'}}`
return pandoc.Pandoc{pandoc.Para('Hi')}:walk {
  Str = function (_) return 'Bye' end,
}

Para

A paragraph

Para

pandoc.Para

A paragraph

clone

(method) pandoc.Para:clone()
  -> pandoc.Para

Make a clone

walk

(method) pandoc.Para:walk(lua_filter: table<string, function>)
  -> pandoc.Para

Apply a Lua filter

Period

string

List numbers are delimited by a period.

Plain

pandoc.Plain

Plain text, not a paragarph

Plain

Plain text, not a paragarph

clone

(method) pandoc.Plain:clone()
  -> pandoc.Plain

Make a clone

walk

(method) pandoc.Plain:walk(lua_filter: table<string, function>)
  -> pandoc.Plain

Apply a Lua filter

Quoted

Quoted text

Quoted

pandoc.Quoted

Quoted text

clone

(method) pandoc.Quoted:clone()
  -> pandoc.Quoted

Make a clone

RawBlock

pandoc.RawBlock

Raw content of a specified format

RawBlock

Raw content of a specified format

clone

(method) pandoc.RawBlock:clone()
  -> pandoc.RawBlock

Make a clone

walk

(method) pandoc.RawBlock:walk(lua_filter: table<string, function>)
  -> pandoc.RawBlock

Apply a Lua filter

RawInline

Raw inline content of a specified format

RawInline

pandoc.RawInline

Raw inline content of a specified format

clone

(method) pandoc.RawInline:clone()
  -> pandoc.RawInline

Make a clone

ReaderOptions

function pandoc.ReaderOptions(opts: pandoc.ReaderOptions|table<string, any>)
  -> pandoc.ReaderOptions

Creates a new ReaderOptions value.

Usage:

-- copy of the reader options that were defined on the command line.
local cli_opts = pandoc.ReaderOptions(PANDOC_READER_OPTIONS)

-- default reader options, but columns set to 66.
local short_colums_opts = pandoc.ReaderOptions {columns = 66}

ReaderOptions

Pandoc reader options

Row

A table row

Row

pandoc.Row

A table row

clone

(method) pandoc.Row:clone()
  -> pandoc.Row

Make a clone

SimpleTable

pandoc.SimpleTable

A simple table is a table structure which resembles the old (pre pandoc 2.10) Table type. Bi-directional conversion from and to Tables is possible with the pandoc.utils.to_simple_table and pandoc.utils.from_simple_table functions, respectively. Instances of this type can also be created directly with the pandoc.SimpleTableconstructor.

SimpleTable

A simple table is a table structure which resembles the old (pre pandoc 2.10) Table type. Bi-directional conversion from and to Tables is possible with the pandoc.utils.to_simple_table and pandoc.utils.from_simple_table functions, respectively. Instances of this type can also be created directly with the pandoc.SimpleTableconstructor.

clone

(method) pandoc.SimpleTable:clone()
  -> pandoc.SimpleTable

Make a clone

SmallCaps

Small caps text

SmallCaps

pandoc.SmallCaps

Small caps text

clone

(method) pandoc.SmallCaps:clone()
  -> pandoc.SmallCaps

Make a clone

SoftBreak

Soft line break

SoftBreak

pandoc.SoftBreak

Soft line break

clone

(method) pandoc.SoftBreak:clone()
  -> pandoc.SoftBreak

Make a clone

Space

Inter-word space

Space

pandoc.Space

Inter-word space

clone

(method) pandoc.Space:clone()
  -> pandoc.Space

Make a clone

Span

pandoc.Span

Generic inline container with attributes

Span

Generic inline container with attributes

clone

(method) pandoc.Span:clone()
  -> pandoc.Span

Make a clone

Str

Text

Str

pandoc.Str

Text

clone

(method) pandoc.Str:clone()
  -> pandoc.Str

Make a clone

Strikeout

Strikeout text

Strikeout

pandoc.Strikeout

Strikeout text

clone

(method) pandoc.Strikeout:clone()
  -> pandoc.Strikeout

Make a clone

Strong

pandoc.Strong

Strongly emphasized text

Strong

Strongly emphasized text

clone

(method) pandoc.Strong:clone()
  -> pandoc.Strong

Make a clone

Subscript

pandoc.Subscript

Subscripted text

Subscript

Subscripted text

clone

(method) pandoc.Subscript:clone()
  -> pandoc.Subscript

Make a clone

Superscript

pandoc.Superscript

Superscripted text

Superscript

Superscripted text

clone

(method) pandoc.Superscript:clone()
  -> pandoc.Superscript

Make a clone

SuppressAuthor

string

Author name is suppressed.

Table

pandoc.Table

A table

A table cell is a list of blocks.

Alignment is a string value indicating the horizontal alignment of a table column. AlignLeft, AlignRight, and AlignCenter leads cell content to be left-aligned, right-aligned, and centered, respectively. The default alignment is AlignDefault (often equivalent to centered).

Table

A table

A table cell is a list of blocks.

Alignment is a string value indicating the horizontal alignment of a table column. AlignLeft, AlignRight, and AlignCenter leads cell content to be left-aligned, right-aligned, and centered, respectively. The default alignment is AlignDefault (often equivalent to centered).

clone

(method) pandoc.Table:clone()
  -> pandoc.Table

Make a clone

walk

(method) pandoc.Table:walk(lua_filter: table<string, function>)
  -> pandoc.Table

Apply a Lua filter

TableBody

A body of a table, with an intermediate head and the specified number of row header columns.

TableBody

pandoc.TableBody

A body of a table, with an intermediate head and the specified number of row header columns.

clone

(method) pandoc.TableBody:clone()
  -> pandoc.TableBody

Make a clone

TableFoot

The foot of a table

TableFoot

pandoc.TableFoot

The foot of a table

clone

(method) pandoc.TableFoot:clone()
  -> pandoc.TableFoot

Make a clone

TableHead

pandoc.TableHead

The head of a table

TableHead

The head of a table

clone

(method) pandoc.TableHead:clone()
  -> pandoc.TableHead

Make a clone

Template

pandoc.Template

Opaque type holding a compiled template.

Template

Opaque type holding a compiled template.

TwoParens

string

List numbers are delimited by a double parentheses.

Underline

Underlined text

Underline

pandoc.Underline

Underlined text

clone

(method) pandoc.Underline:clone()
  -> pandoc.Underline

Make a clone

UpperAlpha

string

List are numbered using upper-case alphabetic characters.

UpperRoman

string

List are numbered using upper-case roman numerals

Version

A version object. This represents a software version like “2.7.3”. The object behaves like a numerically indexed table, i.e., if version represents the version 2.7.3, then

version[1] == 2
version[2] == 7
version[3] == 3
#version == 3   -- length

Comparisons are performed element-wise, i.e.

Version '1.12' > Version '1.9'

Version

pandoc.Version

A version object. This represents a software version like “2.7.3”. The object behaves like a numerically indexed table, i.e., if version represents the version 2.7.3, then

version[1] == 2
version[2] == 7
version[3] == 3
#version == 3   -- length

Comparisons are performed element-wise, i.e.

Version '1.12' > Version '1.9'

must_be_at_least

function pandoc.Version.must_be_at_least(actual: string|integer|integer[]|pandoc.Version, expected: string|integer|integer[]|pandoc.Version, error_message?: string)

Raise an error message if the version is older than the expected version; does nothing if actual is equal to or newer than the expected version.

WriterOptions

function pandoc.WriterOptions(opts: pandoc.WriterOptions|table<string, any>)
  -> pandoc.WriterOptions

Creates a new WriterOptions value.

Usage:

-- copy of the writer options that were defined on the command line.
local cli_opts = pandoc.WriterOptions(PANDOC_WRITER_OPTIONS)

-- default writer options, but DPI set to 300.
local short_colums_opts = pandoc.WriterOptions {dpi = 300}

WriterOptions

Table of the options that will be passed to the writer. While the object can be modified, the changes will not be picked up by pandoc.

cli

table

Command line options and argument parsing.

format

table

image

table

layout

table

log

table

mediabag

table

path

table

pipe

function pandoc.pipe(command: string, args: table, input: string)
  -> string

Runs command with arguments, passing it some input, and returns the output.

read

function pandoc.read(markup: string, format?: string|string[]|{ format: string, extensions: string[]|table<string, boolean|"disable"|"enable"> }, reader_options?: table|pandoc.ReaderOptions)
  -> pandoc.Pandoc

Parse the given string into a Pandoc document.

The parser is run in the same environment that was used to read the main input files; it has full access to the file-system and the mediabag. This means that if the document specifies files to be included, as is possible in formats like LaTeX, reStructuredText, and Org, then these will be included in the resulting document. Any media elements are added to those retrieved from the other parsed input files.

The format parameter defines the format flavor that will be parsed. This can be either a string, using + and - to enable and disable extensions, or a table with fields format (string) and extensions (table). The extensions table can be a list of all enabled extensions, or a table with extensions as keys and their activation status as values (true or 'enable' to enable an extension, false or 'disable' to disable it).

Usage:

local org_markup = "/emphasis/"  -- Input to be read
local document = pandoc.read(org_markup, "org")
-- Get the first block of the document
local block = document.blocks[1]
-- The inline element in that block is an `Emph`
assert(block.content[1].t == "Emph")

readers

{ [string]: boolean }

structure

table

Access to the higher-level document structure, including hierarchical sections and the table of contents.

system

table

template

table

text

table

UTF-8 aware text manipulation functions, implemented in Haskell. The module is made available as part of the pandoc module via pandoc.text. The text module can also be loaded explicitly:

-- uppercase all regular text in a document:
text = require 'text'
function Str (s)
  s.text = text.upper(s.text)
  return s
end

types

table

utils

table

walk_block

function pandoc.walk_block(element: <T>, filter: table)
  -> <T>

Apply a filter inside a block element, walking its contents. Returns a (deep) copy on which the filter has been applied: the original element is left untouched.

walk_inline

function pandoc.walk_inline(element: <T>, filter: table)
  -> <T>
  • Apply a filter inside an inline element, walking its contents. – Returns a (deep) copy on which the filter has been applied: – the original element is left untouched.

write

function pandoc.write(doc: pandoc.Pandoc, format?: string|string[]|{ format: string, extensions: string[]|table<string, boolean|"disable"|"enable"> }, writer_options?: pandoc.WriterOptions|table<string, any>)
  -> string

Converts a document to the given target format.

Usage:

local doc = pandoc.Pandoc(
  {pandoc.Para {pandoc.Strong 'Tea'}}
)
local html = pandoc.write(doc, 'html')
assert(html == "<p><strong>Tea</strong></p>")

write_classic

function pandoc.write_classic(doc: pandoc.Pandoc, writer_options?: pandoc.WriterOptions|table<string, any>)
  -> string

Runs a classic custom Lua writer, using the functions defined in the current environment.

Usage:

-- Adding this function converts a classic writer into a
-- new-style custom writer.
function Writer (doc, opts)
  PANDOC_DOCUMENT = doc
  PANDOC_WRITER_OPTIONS = opts
  loadfile(PANDOC_SCRIPT_FILE)()
  return pandoc.write_classic(doc, opts)
end

writers

{ [string]: boolean }

zip

table