When using mdbook build some_dir
, preprocessor using relative path doesn't work
#2289
Labels
C-bug
Category: A bug, incorrect or unintended behavior
Problem
If I use a preprocessor written in Python, like in documentation example: https://rust-lang.github.io/mdBook/format/configuration/preprocessors.html#provide-your-own-command , it works correctly when I execute
mdbook build
- so thebook.toml
file is in the same directory.In the project I'm working on, book is in the
docs
subdirectory, so it's usually built withmdbook build docs
. But when using this custom preprocessor, it doesn't work when invoked like this, because the PWD is still the main directory, instead ofdocs
directory.This is counterintuitive and limits the ability to use preprocessors.
I created a workaround in the project ( scylladb/scylla-rust-driver#910 ):
but it's ugly and only allows executing from root or
docs
directories.Steps
foo
.bar.py
infoo
directory.foo
directorymdbook build foo
bar.py
couldn't be found.Possible Solution(s)
Before executing preprocessor command change the PWD to the root of the book
Notes
No response
Version
The text was updated successfully, but these errors were encountered: