Skip to content

Support ${workspaceFolder} and variable substitution in pandoc.*OptString settings #52

@ayoussef-insight

Description

@ayoussef-insight

Currently, the vscode-pandoc extension does not expand VS Code variables like ${workspaceFolder} in settings such as pandoc.docxOptString or pandoc.pdfOptString.

For example:

"pandoc.docxOptString": "--reference-doc=${workspaceFolder}/templates/reference.docx"

results in Pandoc receiving the literal string ${workspaceFolder} rather than the resolved path.

This makes it difficult to maintain portable workspace configurations or share templates located in a fixed subfolder.

Expected behaviour

VS Code variables (e.g. ${workspaceFolder}, ${fileDirname}, etc.) should be expanded before invoking Pandoc, matching how variable substitution works in tasks.json and launch.json.

Actual behaviour

Variables are passed literally to Pandoc.

Environment

  • VS Code: (your version)
  • vscode-pandoc: (extension version)
  • OS: (Windows/macOS/Linux)
  • Pandoc version: (output of pandoc --version)

Why this matters

This would let users:

  • Keep relative paths in project configuration.
  • Avoid hard-coded absolute paths.
  • Make multi-workspace and team setups cleaner.

Suggested solution

Use VS Code’s [variable resolver API](https://code.visualstudio.com/api/references/vscode-api#workspace) (e.g. vscode.workspace.getConfiguration() and vscode.workspace.workspaceFolders) to resolve variable placeholders in strings before invoking Pandoc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions