aboutsummaryrefslogtreecommitdiff
path: root/doc/custom-readers.md
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2023-02-12 11:21:14 +0100
committerAlbert Krewinkel <[email protected]>2023-02-12 11:21:14 +0100
commit20d957a3255efb03b78352c4c31850e690bb58c0 (patch)
tree49c437e84a2010c636937b3f7a0eb57844e3bf6e /doc/custom-readers.md
parent75b5851d21b8088c79c0034b66200c5f2a1693db (diff)
docs/custom-readers.md: Update JSON parsing example
The example now uses the built-in `pandoc.json` library to parse the API output.
Diffstat (limited to 'doc/custom-readers.md')
-rw-r--r--doc/custom-readers.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/custom-readers.md b/doc/custom-readers.md
index 1004ca56c..2c72573b4 100644
--- a/doc/custom-readers.md
+++ b/doc/custom-readers.md
@@ -457,16 +457,18 @@ This custom reader consumes the JSON output of
a document containing the current top articles on the
Haskell subreddit.
-It assumes that the `luajson` library is available. (It can be
-installed using `luarocks install luajson`---but be sure you are
-installing it for Lua 5.3, which is the version packaged with
-pandoc.)
+It assumes that the `pandoc.json` library is available, which
+ships with pandoc versions after (not including) 3.1. It's still
+possible to use this with older pandoc version by using a
+different JSON library. E.g., `luajson` can be installed using
+`luarocks install luajson`---but be sure you are installing it for
+Lua 5.4, which is the version packaged with pandoc.
```lua
-- consumes the output of https://www.reddit.com/r/haskell.json
-local json = require'json' -- luajson must be available
+local json = require 'pandoc.json'
local function read_inlines(raw)
local doc = pandoc.read(raw, "commonmark")