Skip to content

feat: Add pandoc path lookup and optional setting #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/quarto-core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface QuartoContext {

/**
* Initialize a Quarto context.
*
*
* @param quartoPath A path to a user-specified Quarto executable. If
* supplied, this will be used in preference to other methods of detecting
* Quarto.
Expand All @@ -44,7 +44,7 @@ export interface QuartoContext {
* @param additionalSearchPaths Additional paths to search for Quarto. These will only be used if
* Quarto is not found in the default locations or the system path.
* @param showWarning A function to call to show a warning message.
*
*
* @returns A Quarto context.
*/
export function initQuartoContext(
Expand Down Expand Up @@ -80,13 +80,13 @@ export function initQuartoContext(
// use cmd suffix for older versions of quarto on windows
const windows = os.platform() == "win32";
const useCmd = windows && semver.lte(quartoInstall.version, "1.1.162");
let pandocPath = path.join(quartoInstall!.binPath, "tools", "pandoc");
let pandocPath = process.env["QUARTO_PANDOC"] || path.join(quartoInstall!.binPath, "tools", "pandoc");
// more recent versions of quarto use architecture-specific tools dir,
// if the pandocPath is not found then look in the requisite dir for this arch
if (!windows && !fs.existsSync(pandocPath)) {
pandocPath = path.join(
path.dirname(pandocPath),
isArm_64() ? "aarch64" : "x86_64",
path.dirname(pandocPath),
isArm_64() ? "aarch64" : "x86_64",
path.basename(pandocPath)
);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ export function initQuartoContext(
}
}

export function quartoContextUnavailable() : QuartoContext {
export function quartoContextUnavailable(): QuartoContext {
return {
available: false,
version: "",
Expand Down Expand Up @@ -179,8 +179,8 @@ function detectUserSpecifiedQuarto(
if (!fs.statSync(quartoPath).isFile()) {
showWarning(
"Specified quarto executable is a directory not a file: '" +
quartoPath +
"'"
quartoPath +
"'"
);
return undefined;
}
Expand All @@ -191,9 +191,9 @@ function detectUserSpecifiedQuarto(

/**
* Scan for Quarto in known locations.
*
*
* @param additionalSearchPaths Additional paths to search for Quarto (optional)
*
*
* @returns A Quarto installation if found, otherwise undefined
*/
function scanForQuarto(additionalSearchPaths?: string[]): QuartoInstallation | undefined {
Expand Down