-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Exit if a preprocessor command is not found #2597
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
I don't think this is something we can do right now, since I believe there are some setups where it is expected to be allowed. Perhaps we could introduce an optional field like there is for renderers (like #1122)? Although that would need to default to false for now. |
I think we could add an optional field as @ehuss suggested that would turn these warnings into errors. By default it would be |
I have added a commit that tries to implement this flag. Is this something like this you had in mind? There are still 2 points that I need to figure out:;
|
I think I figured it out. I added another commit. Here is how I tested it. First I created book: $ ./target/debug/mdbook init my-new-book
Do you want a .gitignore to be created? (y/n)
n
What title would you like to give the book?
test
2025-03-22 14:56:11 [INFO] (mdbook::book::init): Creating a new book with stub content
All done, no errors... The following [book]
authors = ["Pierre Gradot"]
language = "en"
multilingual = false
src = "src"
title = "test"
[build]
build-dir = "book"
create-missing = true
error-on-missing-preprocessor = true
extra-watch-dirs = []
use-default-preprocessors = true I add this at the end of te file (as in the linked issue): [preprocessor.mermaid]
command = "not-a-real-binary" I built the book and got an error: $ ./target/debug/mdbook build my-new-book
2025-03-22 14:58:04 [INFO] (mdbook::book): Book building has started
2025-03-22 14:58:04 [ERROR] (mdbook::preprocess::cmd): The command "not-a-real-binary" wasn't found, is the "mermaid" preprocessor installed? I changed the flag to $ ./target/debug/mdbook build my-new-book
2025-03-22 14:58:19 [INFO] (mdbook::book): Book building has started
2025-03-22 14:58:19 [WARN] (mdbook::preprocess::cmd): The command "not-a-real-binary" wasn't found, is the "mermaid" preprocessor installed?
2025-03-22 14:58:19 [INFO] (mdbook::book): Running the html backend |
This comment has been minimized.
This comment has been minimized.
I have synchronized my fork with the Any opinions on this PR? |
A small change discussed in issue #2493
When a command is not found, log an error and exit the application instead of simply logging a warning. Indeed, the generator of the book will probably be wrong anyway, so exiting seems legit.