You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mdBook fails to open the web browser upon mdbook build --open, if the first link in the summary is a draft chapter (or no links exist in the summary)
#1713
Closed
LikeLakers2 opened this issue
Dec 28, 2021
· 2 comments
· Fixed by #1714
(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".
The text was updated successfully, but these errors were encountered:
LikeLakers2
changed the title
mdBook returns an "IO error" upon trying to open the web browser, when the first link in the summary is a draft chapter, or when there are no links in the summary
mdBook fails to open the web browser upon mdbook build --open, if the first link in the summary is not valid
Dec 28, 2021
LikeLakers2
changed the title
mdBook fails to open the web browser upon mdbook build --open, if the first link in the summary is not valid
mdBook fails to open the web browser upon mdbook build --open, if the first link in the summary is a draft chapter (or no links exist in the summary)
Dec 28, 2021
My guess after looking for a couple minutes: with --open the build command opens the path explicitly to the book's index.html but if the chapter is a draft that file never gets created. Maybe just a better error is the right way to handle this; check that the file exists before calling open and quit with an error from mdbook first.
@joshrotenberg Please ignore my (now-deleted) comment -- I misinterpreted what was going on, and I also misinterpreted what you said. It seems that what you're saying is right.
That said, while I'm not opposed to your solution (it helps with the issue), I would still prefer if mdBook used the first non-draft-chapter as index.html, instead of erroring out if the first chapter is a draft chapter.
(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 thestable-x86_64-pc-windows-msvc
toolchain (currentlyrustc 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:SUMMARY.md
is a draft chapter (e.g.[Chapter 1]()
)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
:with no further detail on what this IO error is.
I would expect mdBook to cover these cases, most likely in the following ways:
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.Steps to reproduce:
SUMMARY.md
file of any book (even a freshly-created book), add a new draft chapter above all other chapters, such as[Chapter 1]()
.--open
parameter, asking mdBook to open the resulting book afterwards.Minimal reproduction project:
mdbook-issue-1713.zip
The text was updated successfully, but these errors were encountered: