Skip to content

Commit 7905e0a

Browse files
committed
feat: expose Typst path in Lua API
1 parent a3439c5 commit 7905e0a

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/command/render/filters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import { pythonExec } from "../../core/jupyter/exec.ts";
9595
import { kTocIndent } from "../../config/constants.ts";
9696
import { isWindows } from "../../deno_ral/platform.ts";
9797
import { tinyTexBinDir } from "../../tools/impl/tinytex-info.ts";
98+
import { typstBinaryPath } from "../../core/typst.ts";
9899

99100
const kQuartoParams = "quarto-params";
100101

@@ -204,6 +205,7 @@ async function quartoEnvironmentParams(_options: PandocOptions) {
204205
"paths": {
205206
"Rscript": await rBinaryPath("Rscript"),
206207
"TinyTexBinDir": tinyTexBinDir(), // will be undefined if no tinytex found and quarto will look in PATH
208+
"Typst": typstBinaryPath(),
207209
},
208210
};
209211
}

src/resources/lua-types/quarto/paths.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ Returns the path to the `TinyTeX` bin directory that `quarto install tinytex` in
1313
]]
1414
---@return string|nil # Path to `TinyTeX` bin directory
1515
function quarto.paths.tinytex_bin_dir() end
16+
17+
--[[
18+
Returns the path to the Typst binary that Quarto itself would use for rendering Typst documents.
19+
This will be the value of the QUARTO_TYPST environment variable if set, or the path to the
20+
Typst binary bundled with Quarto.
21+
]]
22+
---@return string # Path to Typst binary
23+
function quarto.paths.typst() end

src/resources/pandoc/datadir/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@ quarto = {
990990
tinytex_bin_dir = function()
991991
return param('quarto-environment', nil).paths.TinyTexBinDir
992992
end,
993+
typst = function()
994+
return param('quarto-environment', nil).paths.Typst
995+
end,
993996
},
994997
json = json,
995998
base64 = base64,

0 commit comments

Comments
 (0)