Skip to content

Commit a694087

Browse files
committed
Consider QUARTO_PANDOC for pandoc path
1 parent 2c49715 commit a694087

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/quarto-core/src/context.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface QuartoContext {
3535

3636
/**
3737
* Initialize a Quarto context.
38-
*
38+
*
3939
* @param quartoPath A path to a user-specified Quarto executable. If
4040
* supplied, this will be used in preference to other methods of detecting
4141
* Quarto.
@@ -44,7 +44,7 @@ export interface QuartoContext {
4444
* @param additionalSearchPaths Additional paths to search for Quarto. These will only be used if
4545
* Quarto is not found in the default locations or the system path.
4646
* @param showWarning A function to call to show a warning message.
47-
*
47+
*
4848
* @returns A Quarto context.
4949
*/
5050
export function initQuartoContext(
@@ -80,13 +80,13 @@ export function initQuartoContext(
8080
// use cmd suffix for older versions of quarto on windows
8181
const windows = os.platform() == "win32";
8282
const useCmd = windows && semver.lte(quartoInstall.version, "1.1.162");
83-
let pandocPath = path.join(quartoInstall!.binPath, "tools", "pandoc");
83+
let pandocPath = process.env["QUARTO_PANDOC"] || path.join(quartoInstall!.binPath, "tools", "pandoc");
8484
// more recent versions of quarto use architecture-specific tools dir,
8585
// if the pandocPath is not found then look in the requisite dir for this arch
8686
if (!windows && !fs.existsSync(pandocPath)) {
8787
pandocPath = path.join(
88-
path.dirname(pandocPath),
89-
isArm_64() ? "aarch64" : "x86_64",
88+
path.dirname(pandocPath),
89+
isArm_64() ? "aarch64" : "x86_64",
9090
path.basename(pandocPath)
9191
);
9292
}
@@ -114,7 +114,7 @@ export function initQuartoContext(
114114
}
115115
}
116116

117-
export function quartoContextUnavailable() : QuartoContext {
117+
export function quartoContextUnavailable(): QuartoContext {
118118
return {
119119
available: false,
120120
version: "",
@@ -179,8 +179,8 @@ function detectUserSpecifiedQuarto(
179179
if (!fs.statSync(quartoPath).isFile()) {
180180
showWarning(
181181
"Specified quarto executable is a directory not a file: '" +
182-
quartoPath +
183-
"'"
182+
quartoPath +
183+
"'"
184184
);
185185
return undefined;
186186
}
@@ -191,9 +191,9 @@ function detectUserSpecifiedQuarto(
191191

192192
/**
193193
* Scan for Quarto in known locations.
194-
*
194+
*
195195
* @param additionalSearchPaths Additional paths to search for Quarto (optional)
196-
*
196+
*
197197
* @returns A Quarto installation if found, otherwise undefined
198198
*/
199199
function scanForQuarto(additionalSearchPaths?: string[]): QuartoInstallation | undefined {

0 commit comments

Comments
 (0)