Build books to a temporary directory before publishing
Building books to a temporary directory before publishing will produce a number of improvements.
The description below is specifically about how using temp dirs will help us avoid broken books. But other benefits come with using temp dirs as well, which are described in more detail in the comments below
Steps to reproduce
- Set up a book which has a broken internal hyperlink in some page content.
- When you go into this book (outside of docs-publisher) and run
mkdocs serve
, you should see something like this:WARNING - The page "index.md" contained a hyperlink to "documentation.md" which is not listed in the "pages" configuration.
- Get docs-publisher to publish this book.
- Because we publish with
--strict
(generally good) themkdocs build
process will fail - After the failure, the published book will be broken.
Suggested implementation
- When publishing a book, first set up a temporary directory in which to build the files
- Run
mkdocs build
- If everything goes according to plan, replace the live directory with the newly built directory
- If any errors are encountered trash the built directory and report the errors
This ticket is a simplification of #39 (closed)