(Hope you don't mind, but I'm going to use a template similar to Godot Engine's issue template. Makes it easier to read the issue, in my opinion. :D )
mdBook version:
mdbook v0.4.14, installed via cargo install mdbook, compiled via the stable-x86_64-pc-windows-msvc toolchain (currently rustc 1.57.0 (f1edd0429 2021-11-29) as of this issue posting)
Issue description:
mdBook fails to open the web browser upon building the book, when building using mdbook build --open, if one of the following conditions are met:
- The first link in
SUMMARY.md is a draft chapter (e.g. [Chapter 1]())
- The
SUMMARY.md file is devoid of links.
If either of these conditions are met, then mdBook returns an error upon trying to mdbook build --open:
[INFO] (mdbook): Opening web browser
[ERROR] (mdbook): Error opening web browser: IO error
with no further detail on what this IO error is.
I would expect mdBook to cover these cases, most likely in the following ways:
- If the first link in
SUMMARY.md is a draft chapter, then I would expect it to look to the next chapter, and the next, and the next, etc... until it finds a valid link, which it opens the web browser to.
- If mdBook cannot find a valid link, I would expect it to return an error saying as such. For example, "Could not find a valid book page to open to!"
Steps to reproduce:
- In the
SUMMARY.md file of any book (even a freshly-created book), add a new draft chapter above all other chapters, such as [Chapter 1]().
- Attempt to build with the
--open parameter, asking mdBook to open the resulting book afterwards.
- Observe that mdBook will return a vague "IO error".
Minimal reproduction project:
mdbook-issue-1713.zip