-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supply RSTUDIO_PANDOC to packaging tasks, including R Markdown render (…
…#3856) Several beta users have already reported trouble rendering documents with Positron because the render tasks can't find Pandoc, even though it ships with Positron. This change supplies the`RSTUDIO_PANDOC` environment variable when running packaging tasks and R Markdown rendering jobs. It's done using the same logic we use to supply `RSTUDIO_PANDOC` to the main R session. Addresses #3776. ### QA Notes The embedded Pandoc is only used when there's no other Pandoc on the `$PATH`. To test this, uninstall all your Pandocies (make sure `which pandoc` returns nothing) first so that only the bundled Pandoc is available. This also touches the code that injects Pandoc into the main R session, so make sure e.g. `rmarkdown::pandoc_version()` still works there.
- Loading branch information
Showing
3 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (C) 2024 Posit Software, PBC. All rights reserved. | ||
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from 'vscode'; | ||
import { existsSync } from 'fs'; | ||
import * as path from 'path'; | ||
|
||
/** | ||
* Discovers the path to the pandoc executable that ships with Positron. | ||
* | ||
* @returns The path to the pandoc executable, if it exists. | ||
*/ | ||
export function getPandocPath(): string | undefined { | ||
const pandocPath = path.join(vscode.env.appRoot, | ||
process.platform === 'darwin' ? | ||
path.join('bin', 'pandoc') : | ||
path.join('..', '..', 'bin', 'pandoc')); | ||
if (existsSync(pandocPath)) { | ||
return pandocPath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters