From b82fdf1debdab6aca5bf062193343a3345727d1d Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 1 Nov 2022 18:31:03 +0100 Subject: [PATCH] Add book for testing --- .gitignore | 2 +- README.md | 4 ++-- book/book.toml | 9 +++++++++ book/footer.css | 6 ++++++ book/src/README.md | 8 ++++++++ book/src/SUMMARY.md | 6 ++++++ book/src/configuration.md | 39 +++++++++++++++++++++++++++++++++++++++ book/src/installation.md | 15 +++++++++++++++ book/src/license.md | 4 ++++ book/src/requirements.md | 5 +++++ 10 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 book/book.toml create mode 100644 book/footer.css create mode 100644 book/src/README.md create mode 100644 book/src/SUMMARY.md create mode 100644 book/src/configuration.md create mode 100644 book/src/installation.md create mode 100644 book/src/license.md create mode 100644 book/src/requirements.md diff --git a/.gitignore b/.gitignore index 30bc05c..1c8f72e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/book +/book/book /target **/*.rs.bk diff --git a/README.md b/README.md index ff93df6..9f17528 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ cargo install mdbook-last-changed Add it as a preprocessor to your `book.toml`: -``` +```toml [preprocessor.last-changed] command = "mdbook-last-changed" renderer = ["html"] @@ -71,4 +71,4 @@ mdbook path/to/book ## License MPL. See [LICENSE](LICENSE). -Copyright (c) 2020-2022 Jan-Erik Rediger +Copyright (c) 2022 Jan-Erik Rediger diff --git a/book/book.toml b/book/book.toml new file mode 100644 index 0000000..9204cd1 --- /dev/null +++ b/book/book.toml @@ -0,0 +1,9 @@ +[book] +title = "mdbook-last-changed" + +[output.html] +git-repository-url = "https://github.com/badboy/mdbook-last-changed" +additional-css = ["footer.css"] + +[preprocessor.last-changed] +command = "cargo run --manifest-path ../Cargo.toml" diff --git a/book/footer.css b/book/footer.css new file mode 100644 index 0000000..7c46d76 --- /dev/null +++ b/book/footer.css @@ -0,0 +1,6 @@ +footer { + font-size: 0.8em; + text-align: center; + border-top: 1px solid black; + padding: 5px 0; +} diff --git a/book/src/README.md b/book/src/README.md new file mode 100644 index 0000000..bdd514c --- /dev/null +++ b/book/src/README.md @@ -0,0 +1,8 @@ +# mdbook-last-changed + +A preprocessor for [mdbook][] to add a page's last change date and a link to the commit on every page. + +[mdbook]: https://github.com/rust-lang/mdBook + +It adds a "Last change" footer, including a date and a link to the corresponding commit. +It uses the configured `git-repository-url` as the base. diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md new file mode 100644 index 0000000..6c479d6 --- /dev/null +++ b/book/src/SUMMARY.md @@ -0,0 +1,6 @@ +[Introduction](README.md) + +* [Requirements](requirements.md) +* [Installation](installation.md) +* [Configuration](configuration.md) +* [License](license.md) diff --git a/book/src/configuration.md b/book/src/configuration.md new file mode 100644 index 0000000..55e8a51 --- /dev/null +++ b/book/src/configuration.md @@ -0,0 +1,39 @@ +# Configuration + +`mdbook-last-changed` is configured using additional options under `[output.html]`: + + +```toml +[output.html] +# Required: Your repository URL used in the link. +git-repository-url = "https://github.com/$user/$project" +``` + +To style the footer add a custom CSS file for your HTML output: + +```toml +[output.html] +additional-css = ["last-changed.css"] +``` + +And in `last-changed.css` style the `