aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-10 09:33:20 +0200
committerAlbert Krewinkel <[email protected]>2022-10-10 11:27:42 +0200
commita5ffaaa4136f11378c0c7741309edb9fd53e17d8 (patch)
treeafa29d609290f50cf752754cfca4a23075dc2781 /doc
parentd6fb8fb20fbb822d58cdfbde34961094c902a708 (diff)
Lua: support custom bytestring readers.
Diffstat (limited to 'doc')
-rw-r--r--doc/custom-readers.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/custom-readers.md b/doc/custom-readers.md
index add2317a2..601d879dd 100644
--- a/doc/custom-readers.md
+++ b/doc/custom-readers.md
@@ -76,6 +76,23 @@ ensuring backwards compatibility.
[patterns]: http://lua-users.org/wiki/PatternsTutorial
[lpeg]: http://www.inf.puc-rio.br/~roberto/lpeg/
+# Bytestring readers
+
+Pandoc expects text input to be UTF-8 encoded. However, formats
+like docx, odt, epub, etc. are not text but binary formats. To
+read them, pandoc supports `ByteStringReader` functions. These
+functions work just like the `Reader` function that process text
+input, but instead of a list of sources, `ByteStringReader`
+functions are passed a bytestring, i.e., a string that contains
+the binary input.
+
+``` lua
+-- read input as epub
+function ByteStringReader (input)
+ return pandoc.read(input, 'epub')
+end
+```
+
# Example: plain text reader
This is a simple example using [lpeg] to parse the input