From b331d1629d3ab7faa291e0dae22b55166daa043c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micka=C3=ABl=20Canouil?=
<8896044+mcanouil@users.noreply.github.com>
Date: Sat, 6 Dec 2025 11:24:04 +0100
Subject: [PATCH 1/3] feat: add Lua API for Pandoc path retrieval
---
news/changelog-1.9.md | 4 ++++
src/command/render/filters.ts | 3 ++-
src/resources/lua-types/quarto/paths.lua | 8 ++++++++
src/resources/pandoc/datadir/init.lua | 3 +++
tests/docs/smoke-all/2025/12/06/pandoc-path-api.lua | 7 +++++++
tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd | 12 ++++++++++++
6 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 tests/docs/smoke-all/2025/12/06/pandoc-path-api.lua
create mode 100644 tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md
index 4027d871323..aba0b25037f 100644
--- a/news/changelog-1.9.md
+++ b/news/changelog-1.9.md
@@ -68,6 +68,10 @@ All changes included in 1.9:
- ([#13414](https://github.com/quarto-dev/quarto-cli/issues/13414)): Be more forgiving when Confluence server returns malformed JSON response. (author: @m1no)
+## Lua API
+
+- Added `quarto.paths.pandoc()` to expose the path to the Pandoc binary that Quarto uses for rendering. This respects the `QUARTO_PANDOC` environment variable if set, or returns the path to the bundled Pandoc binary.
+
## Other fixes and improvements
- ([#13402](https://github.com/quarto-dev/quarto-cli/issues/13402)): `nfpm` () is now used to create the `.deb` package, and new `.rpm` package. Both Linux packages are also now built for `x86_64` (`amd64`) and `aarch64` (`arm64`) architectures.
diff --git a/src/command/render/filters.ts b/src/command/render/filters.ts
index fdb4281d4f2..ba0f6877e03 100644
--- a/src/command/render/filters.ts
+++ b/src/command/render/filters.ts
@@ -67,7 +67,7 @@ import { QuartoFilterSpec } from "./types.ts";
import { Metadata } from "../../config/types.ts";
import { kProjectType } from "../../project/types.ts";
import { bibEngine } from "../../config/pdf.ts";
-import { rBinaryPath, resourcePath } from "../../core/resources.ts";
+import { rBinaryPath, resourcePath, pandocBinaryPath } from "../../core/resources.ts";
import { crossrefFilterActive, crossrefFilterParams } from "./crossref.ts";
import { layoutFilterParams } from "./layout.ts";
import { pandocMetadataPath } from "./render-paths.ts";
@@ -204,6 +204,7 @@ async function quartoEnvironmentParams(_options: PandocOptions) {
"paths": {
"Rscript": await rBinaryPath("Rscript"),
"TinyTexBinDir": tinyTexBinDir(), // will be undefined if no tinytex found and quarto will look in PATH
+ "Pandoc": pandocBinaryPath(),
},
};
}
diff --git a/src/resources/lua-types/quarto/paths.lua b/src/resources/lua-types/quarto/paths.lua
index fdb86c1d115..8647e05a2f0 100644
--- a/src/resources/lua-types/quarto/paths.lua
+++ b/src/resources/lua-types/quarto/paths.lua
@@ -13,3 +13,11 @@ Returns the path to the `TinyTeX` bin directory that `quarto install tinytex` in
]]
---@return string|nil # Path to `TinyTeX` bin directory
function quarto.paths.tinytex_bin_dir() end
+
+--[[
+Returns the path to the Pandoc binary that Quarto itself would use for rendering documents.
+This will be the value of the QUARTO_PANDOC environment variable if set, or the path to the
+Pandoc binary bundled with Quarto.
+]]
+---@return string # Path to Pandoc binary
+function quarto.paths.pandoc() end
diff --git a/src/resources/pandoc/datadir/init.lua b/src/resources/pandoc/datadir/init.lua
index d9639b02e1c..4571f24f242 100644
--- a/src/resources/pandoc/datadir/init.lua
+++ b/src/resources/pandoc/datadir/init.lua
@@ -990,6 +990,9 @@ quarto = {
tinytex_bin_dir = function()
return param('quarto-environment', nil).paths.TinyTexBinDir
end,
+ pandoc = function()
+ return param('quarto-environment', nil).paths.Pandoc
+ end,
},
json = json,
base64 = base64,
diff --git a/tests/docs/smoke-all/2025/12/06/pandoc-path-api.lua b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.lua
new file mode 100644
index 00000000000..670c20850a9
--- /dev/null
+++ b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.lua
@@ -0,0 +1,7 @@
+function pandoc_path()
+ return quarto.paths.pandoc()
+end
+
+return {
+ ["pandoc"] = pandoc_path
+}
diff --git a/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
new file mode 100644
index 00000000000..f739488b39c
--- /dev/null
+++ b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
@@ -0,0 +1,12 @@
+---
+format: html
+shortcodes:
+ - pandoc-path-api.lua
+_quarto:
+ tests:
+ html:
+ ensureFileRegexMatches:
+ - ["
The Pandoc path is .+.
"]
+---
+
+The Pandoc path is "{{< pandoc >}}".
From e7213f60c0bf5775a28aece4527ba3ed5360c77a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micka=C3=ABl=20Canouil?=
<8896044+mcanouil@users.noreply.github.com>
Date: Sat, 6 Dec 2025 11:28:28 +0100
Subject: [PATCH 2/3] test: make regexpt a bit more specific
---
tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
index f739488b39c..a05637baafc 100644
--- a/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
+++ b/tests/docs/smoke-all/2025/12/06/pandoc-path-api.qmd
@@ -6,7 +6,7 @@ _quarto:
tests:
html:
ensureFileRegexMatches:
- - ["The Pandoc path is .+.
"]
+ - ["The Pandoc path is .+pandoc.
"]
---
-The Pandoc path is "{{< pandoc >}}".
+The Pandoc path is `{{< pandoc >}}`.
From 1d03c8fee2dea831682de9d557f317f06e78c2ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micka=C3=ABl=20Canouil?=
<8896044+mcanouil@users.noreply.github.com>
Date: Sat, 6 Dec 2025 11:36:54 +0100
Subject: [PATCH 3/3] chore: harmonise changelog entry with PR number
---
news/changelog-1.9.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md
index aba0b25037f..f7ed71a7de7 100644
--- a/news/changelog-1.9.md
+++ b/news/changelog-1.9.md
@@ -70,7 +70,7 @@ All changes included in 1.9:
## Lua API
-- Added `quarto.paths.pandoc()` to expose the path to the Pandoc binary that Quarto uses for rendering. This respects the `QUARTO_PANDOC` environment variable if set, or returns the path to the bundled Pandoc binary.
+- ([#13763](https://github.com/quarto-dev/quarto-cli/issues/13763)): Add `quarto.paths.pandoc()` to expose the path to the Pandoc binary. (author: @mcanouil)
## Other fixes and improvements