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

Conversation

fflores97
Copy link

@fflores97 fflores97 commented Jun 19, 2025

More general solution to pandoc path issues I encountered. I re-use path lookup logic that looks for the quarto binary to find the pandoc binary, and added a setting in case the user wants to hardcode it.

Would love some help with the frequent paths for the pandoc binary and just contributing to this repo in general.

Thanks!

@fflores97 fflores97 changed the title Add pandoc path lookup and optional setting feat: Add pandoc path lookup and optional setting Jun 19, 2025
@cderv
Copy link
Contributor

cderv commented Jun 19, 2025

Hi! Thanks for your contribution.

Can you reexplain the problem you are trying solve? I understand this is because of Nix specific build and setup for QUarto, right?

To remind you of the context, Quarto works with an expected version of Pandoc. Quarto's installer does bundle Pandoc, and the VSCODE extension currently looks in there.
Nix has a specific setup because it rebuilds Quarto by using an external Pandoc.
Quarto allows that through QUARTO_PANDOC environment variable, but quarto is still meant to work with the expected version of Pandoc. When use with another version, there is no warranty of 💯 % working.

Nix package does set QUARTO_PANDOC: https://github.com/NixOS/nixpkgs/blob/9cd27c52f82d1d8122b11c5c3556cccc12805d86/pkgs/development/libraries/quarto/default.nix#L62

So I wonder if the "fix" should be to look for QUARTO_PANDOC env var if Pandoc is not found in the expected place inside the Quarto install folder.

Nix could also add symlink in the expected place.

I hope it makes sense. I am trying to prevent side effects if the VSCode extension starts to detect unwanted Pandoc.

@fflores97
Copy link
Author

Thank you, Christophe. The problem is that the NixOS quarto package doesn't bundle pandoc inside it like in other distributions. In fact, nixpkgs explicitely deletes it, so the default pandocPath variable won't consider other pandoc paths.

I like your idea better, though. As far as I can tell, currently nothing in the codebase uses QUARTO_PANDOC, but I see it as a good chance to use it. I just tried this and could get visual edit mode to work with just the env variable. Very elegant!

@cderv
Copy link
Contributor

cderv commented Jun 20, 2025

Yes, I know they remove it - they set the env var to the real location. They could also have done symlink I guess.

The env var is the expected advanced way to change Pandoc used by Quarto, so I would use this instead of trying to detect outside of Quarto.

@fflores97
Copy link
Author

Check out the current status of my branch. I reset all my changes to go with just the env variable (plus some auto-formatting apparently). Works for my use. Would love your guidance to eventually get this merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants