mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Providing your own command for a preprocessor doesn't evaluate $ENV_VARS

Open slmgc opened this issue 1 year ago • 1 comments

Problem

Currently, there is no way to define a custom preprocessor in case the command-line arguments contain an environment variable which needs to be evaluated as a part of the script's path.

Steps

Adding a preprocessor to a book.toml:

[preprocessor.example]
command = "python $HOME/example.py" # that doesn't work

mdbook build fails with an error:

Python: can't open file '$HOME/example.py' # please note that $HOME env var was not evaluated

Using a relative path or an absolute path works fine:

command = "python example.py" # that works
command = "python /absolute/path/example.py" # that works fine
command = "python ../../relative/path/example.py" # that works as well

Possible Solution(s)

No response

Notes

No response

Version

mdbook v0.4.27

slmgc avatar Mar 04 '23 01:03 slmgc

@rustbot claim

kumavale avatar Mar 08 '23 13:03 kumavale