Add book for testing
parent
708336f35e
commit
b82fdf1deb
|
@ -1,3 +1,3 @@
|
||||||
/book
|
/book/book
|
||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
|
@ -23,7 +23,7 @@ cargo install mdbook-last-changed
|
||||||
|
|
||||||
Add it as a preprocessor to your `book.toml`:
|
Add it as a preprocessor to your `book.toml`:
|
||||||
|
|
||||||
```
|
```toml
|
||||||
[preprocessor.last-changed]
|
[preprocessor.last-changed]
|
||||||
command = "mdbook-last-changed"
|
command = "mdbook-last-changed"
|
||||||
renderer = ["html"]
|
renderer = ["html"]
|
||||||
|
@ -71,4 +71,4 @@ mdbook path/to/book
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MPL. See [LICENSE](LICENSE).
|
MPL. See [LICENSE](LICENSE).
|
||||||
Copyright (c) 2020-2022 Jan-Erik Rediger <janerik@fnordig.de>
|
Copyright (c) 2022 Jan-Erik Rediger <janerik@fnordig.de>
|
||||||
|
|
|
@ -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"
|
|
@ -0,0 +1,6 @@
|
||||||
|
footer {
|
||||||
|
font-size: 0.8em;
|
||||||
|
text-align: center;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
|
@ -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.
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Introduction](README.md)
|
||||||
|
|
||||||
|
* [Requirements](requirements.md)
|
||||||
|
* [Installation](installation.md)
|
||||||
|
* [Configuration](configuration.md)
|
||||||
|
* [License](license.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 `<footer>` element or directly the CSS element id `last-changed`:
|
||||||
|
|
||||||
|
```css
|
||||||
|
footer {
|
||||||
|
font-size: 0.8em;
|
||||||
|
text-align: center;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This code block shrinks the text size, center-aligns it under the rest of the content
|
||||||
|
and adds a small horizontal bar above the text to separate it from the page content.
|
||||||
|
|
||||||
|
|
||||||
|
Finally, build your book as normal:
|
||||||
|
|
||||||
|
```
|
||||||
|
mdbook path/to/book
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
If you want to use only this preprocessor, install the tool:
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo install mdbook-last-changed
|
||||||
|
```
|
||||||
|
|
||||||
|
Add it as a preprocessor to your `book.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[preprocessor.last-changed]
|
||||||
|
command = "mdbook-last-changed"
|
||||||
|
renderer = ["html"]
|
||||||
|
```
|
|
@ -0,0 +1,4 @@
|
||||||
|
# License
|
||||||
|
|
||||||
|
MPL. See [LICENSE](https://github.com/badboy/mdbook-last-changed/blob/main/LICENSE).
|
||||||
|
Copyright (c) 2022 Jan-Erik Rediger <janerik@fnordig.de>
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
* The `git` command line tool.
|
||||||
|
* A configured git repository url in your `book.toml` configuration. See [Configuration](#configuration).
|
||||||
|
* Access to the git repository checkout while building your book.
|
Loading…
Reference in New Issue