Michael-F-Bryan / mdbook-linkcheck

A backend for `mdbook` which will check your links for you.

Home Page:https://michael-f-bryan.github.io/mdbook-linkcheck/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Respect book.build-dir

CreepySkeleton opened this issue · comments

I have the following settings:

[book]
authors = ["CreepySkeleton"]
# ...

[build]
build-dir = "docs/" # I want the docs to be put into docs/ folder instead of book/ 

[output.html]

[output.linkcheck]
# ...

unfortunately, this setup does not respect build-dir, placing the generated files into docs/html. Any way to fix it?

I'm pretty sure that's how mdbook is intended to work. If there's only one backend (i.e. the default HTML renderer) it'll put the generated files in your build-dir (which you've specified as docs/), but when there are multiple backends each backend is told to write to a separate directory. In this case, docs/html/ for the HTML renderer and docs/linkcheck/ for the linkcheck cache.

Looking at the source code, mdbook-linkcheck seems to write to whichever directory it is told to write to by mdbook. So maybe this is a mdbook bug?

I wouldn't call it a bug, the "one subfolder for each backend" is totally understandable. And yet, this behavior (the sudden change from docs to docs/html) is quite surprising. Maybe just document it properly, stressing the fact that every backend gets its own subfolder?

the sudden change from docs to docs/html

I'm guessing it changed when you enabled [output.linkcheck]?

I'll update the mdbook-linkcheck README to mention that when you enable linkchecking mdbook will change the directory HTML gets written to.

Would it be worth creating an issue against the mdbook repo to update their build-dir docs to mention this behaviour?

I'm guessing it changed when you enabled [output.linkcheck]?

Yes, exactly. It was surprising.

Would it be worth creating an issue against the mdbook repo to update their build-dir docs to mention this behaviour?

I think it would.