File tree Expand file tree Collapse file tree 2 files changed +55
-4
lines changed Expand file tree Collapse file tree 2 files changed +55
-4
lines changed Original file line number Diff line number Diff line change 1- # Revision history for pandoc
1+ ## Revision history for pandoc
22
33## pandoc 2.16.2 (2021-11-21)
44
147147 * Require Cabal 2.4. Use wildcards to ensure that all pptx tests are
148148 included (#7677).
149149
150- * Update bash_completion.tpl (S.P.H.).
150+ * Update ` bash_completion.tpl` (S.P.H.).
151151
152152 * Add `data/creole.lua` as sample custom reader.
153153
154- * Add `doc/custom-readers.md`.
154+ * Add `doc/custom-readers.md` and `doc/custom-writers.md` .
155155
156- * MANUAL.txt: update table of exit codes and corresponding errors
156+ * `doc/lua-filters.md`: add section on global modules, including lpeg
157+ (Albert Krewinkel).
158+
159+ * `MANUAL.txt`: update table of exit codes and corresponding errors
157160 (Albert Krewinkel).
158161
159162 * Use latest texmath.
Original file line number Diff line number Diff line change 1+ ---
2+ author :
3+ - John MacFarlane
4+ date : ' November 21, 2021'
5+ title : Creating Custom Pandoc Writers in Lua
6+ ---
7+
8+ # Introduction
9+
10+ If you need to render a format not already handled by pandoc,
11+ or you want to change how pandoc renders a format,
12+ you can create a custom writer using the [ Lua] language.
13+ Pandoc has a built-in Lua interpreter, so you needn't
14+ install any additional software to do this.
15+
16+ [ Lua ] : https://www.lua.org
17+
18+ A custom writer is a Lua file that defines functions for
19+ rendering each element of a pandoc AST.
20+
21+ For example,
22+
23+ ``` lua
24+ function Para (s )
25+ return " <paragraph>" .. s .. " </paragraph>"
26+ end
27+ ```
28+
29+ The best way to go about creating a custom writer is to modify
30+ the example that comes with pandoc. To get the example, you
31+ can do
32+
33+ ```
34+ pandoc --print-default-data-file sample.lua > sample.lua
35+ ```
36+
37+ ` sample.lua ` is a full-features HTML writer, with explanatory
38+ comments. To use it, just use the path to the custom writer as
39+ the writer name:
40+
41+ ```
42+ pandoc -t sample.lua myfile.md
43+ ```
44+
45+ ` sample.lua ` defines all the functions needed by any custom
46+ writer, so you can design your own custom writer by modifying
47+ the functions in ` sample.lua ` according to your needs.
48+
You can’t perform that action at this time.
0 commit comments