aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2021-12-31 18:59:52 +0100
committerJohn MacFarlane <[email protected]>2022-01-04 11:55:59 -0800
commit0d1d52f0a00753691663572da5f87dd4791d65fd (patch)
tree777cc38c1062669d44ce0fc1cc493d74e8d150cd /doc
parent5c53837259b341ddd00eea926f0297cfc963d816 (diff)
Lua: add function `pandoc.write`
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 626ecb59f..5a8705326 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -3280,6 +3280,39 @@ Usage:
[ReaderOptions]: #type-readeroptions
+### write {#pandoc.write}
+
+`write (doc[, format[, writer_options]])`
+
+Converts a document to the given target format.
+
+Parameters:
+
+`doc`:
+: document to convert ([Pandoc](#type-pandoc))
+
+`format`:
+: format specification, defaults to `'html'` (string)
+
+`writer_options`:
+: options passed to the writer; may be a WriterOptions object
+ or a table with a subset of the keys and values of a
+ WriterOptions object; defaults to the default values
+ documented in the manual. ([WriterOptions]|table)
+
+Returns:
+- converted document (string)
+
+Usage:
+
+ local doc = pandoc.Pandoc(
+ {pandoc.Para {pandoc.Strong 'Tea'}}
+ )
+ local html = pandoc.write(doc, 'html')
+ assert(html == "<p><strong>Tea</strong></p>")
+
+[WriterOptions]: #type-writeroptions
+
# Module pandoc.utils
This module exposes internal pandoc functions and utility