building with mdbook as a library

This commit is contained in:
sneakers-the-rat 2023-06-05 19:27:03 -07:00
parent cd71eb6641
commit 676b41da14
4 changed files with 15 additions and 19 deletions

View file

@ -43,6 +43,8 @@ jobs:
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
# mdbook build
# the binary of the package builds the book!
docs
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""

View file

@ -12,7 +12,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
[dependencies]
mdbook = "0.4.30"
mdbook-bib = "0.0.5"
mdbook-mermaid = "0.12.6"

View file

@ -1,17 +0,0 @@
// build.rs
// following https://github.com/tchernobog/rfcs/blob/master/text/0000-cargo-run-deps.md
use std::{env, process::Command};
fn main() {
let cargo_path = env::var("CARGO").unwrap();
let mut mdbook = Command::new(cargo_path).args(&[
"run",
"--package",
"mdbook",
"--",
"build",
]);
println!("Built book!")
}

View file

@ -1,5 +1,16 @@
// dummy file
use mdbook::MDBook;
fn main() {
println!("This package does nothing! It's just for gathering deps to build the book!")
let root_dir = "./";
let mut md = MDBook::load(root_dir)
.expect("Unable to load the book");
md.build().expect("Building failed");
// println!("This package does nothing! It's just for gathering deps to build the book!")
}