Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badboy/mdbook-last-changed
https://github.com/badboy/mdbook-last-changed
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/badboy/mdbook-last-changed
- Owner: badboy
- License: mpl-2.0
- Created: 2022-10-18T19:09:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-05T18:00:24.000Z (over 1 year ago)
- Last Synced: 2024-12-24T02:01:28.355Z (12 days ago)
- Language: Rust
- Homepage: https://badboy.github.io/mdbook-last-changed/
- Size: 1.42 MB
- Stars: 13
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.## Requirements
* The `git` command line tool.
* Access to the git repository checkout while building your book.## 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"]
```## Configuration
`mdbook-last-changed` is configured using additional options under `[output.html]`:
```toml
[output.html]
# Optional: Your repository URL used in the link.
git-repository-url = "https://github.com/$user/$project"
```If `git-repository-url` is not configured the footer will not contain the commit and a link to it and instead only show the last changed date.
Without `git-repository-url` configured:
```HTML
Last change: 2023-07-09
```With `git-repository-url` configured:
```HTML
Last change: 2023-07-09, commit: 0000000
```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 `` 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
```## License
MPL. See [LICENSE](LICENSE).
Copyright (c) 2022 Jan-Erik Rediger