diff --git a/lua/PandocCLI/Lua.hs b/lua/PandocCLI/Lua.hs
--- a/lua/PandocCLI/Lua.hs
+++ b/lua/PandocCLI/Lua.hs
@@ -11,6 +11,9 @@
 
 import Control.Monad ((<=<))
 import HsLua.CLI (EnvBehavior (..), Settings (..), runStandalone)
+import System.Environment (lookupEnv)
+import System.IO.Temp (withSystemTempFile)
+import System.IO (hClose)
 import Text.Pandoc.Class (runIOorExplode)
 import Text.Pandoc.Error (handleError)
 import Text.Pandoc.Lua (runLua, runLuaNoEnv, getEngine)
@@ -18,16 +21,32 @@
 
 -- | Runs pandoc as a Lua interpreter that is (mostly) compatible with
 -- the default @lua@ program shipping with Lua.
+--
+-- The filename for the history of the REPL is taken from the
+-- @PANDOC_REPL_HISTORY@ environment variable if possible. Otherwise a
+-- new temporary file is used; it is removed after the REPL finishes.
 runLuaInterpreter :: String    -- ^ Program name
                   -> [String]  -- ^ Command line arguments
                   -> IO ()
 runLuaInterpreter progName args = do
-  let settings = Settings
-        { settingsVersionInfo = "\nEmbedded in pandoc " <> pandocVersionText
-        , settingsRunner = runner
-        }
-  runStandalone settings progName args
+  -- We need some kind of temp
+  mbhistfile <- lookupEnv "PANDOC_REPL_HISTORY"
+  case mbhistfile of
+    Just histfile -> runStandaloneWithHistory histfile
+    Nothing -> withSystemTempFile "pandoc-hist" $ \fp handle -> do
+      -- We cannot pass a handle to the repl; the file will be re-opened
+      -- there.
+      hClose handle
+      runStandaloneWithHistory fp
   where
+    runStandaloneWithHistory histfile =  do
+      let settings = Settings
+            { settingsVersionInfo = "\nEmbedded in pandoc " <>
+                                    pandocVersionText
+            , settingsRunner = runner
+            , settingsHistory = Just histfile
+            }
+      runStandalone settings progName args
     runner envBehavior =
       let runLua' = case envBehavior of
                       IgnoreEnvVars  -> runLuaNoEnv
diff --git a/pandoc-cli.cabal b/pandoc-cli.cabal
--- a/pandoc-cli.cabal
+++ b/pandoc-cli.cabal
@@ -1,6 +1,6 @@
 cabal-version:   2.4
 name:            pandoc-cli
-version:         0.1
+version:         0.1.1
 build-type:      Simple
 license:         GPL-2.0-or-later
 license-file:    COPYING.md
@@ -85,8 +85,9 @@
     hs-source-dirs:  no-server
 
   if flag(lua)
-    build-depends:   hslua-cli         >= 1.2 && < 1.3,
-                     pandoc-lua-engine >= 0.1 && < 0.2
+    build-depends:   hslua-cli         >= 1.4.1 && < 1.5,
+                     pandoc-lua-engine >= 0.2 && < 0.3,
+                     temporary         >= 1.1 && < 1.4
     hs-source-dirs:  lua
   else
     hs-source-dirs:  no-lua
