Skip to content

Commit 5bbf405

Browse files
committed
chore: bump v1.0.0 to v1.1.0
1 parent da4df91 commit 5bbf405

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mdbook-gitinfo"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
edition = "2024"
55
authors = ["Seb Blair <s.blair@gre.ac.uk>"]
66
description = "An mdBook preprocessor to inject Git commit metadata into generated books"

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ An <a href="https://github.com/rust-lang/mdBook">mdBook</a> preprocessor that in
2929
- Message templating via `message.header` / `message.footer` / `message.both`.
3030
- Split **alignment** for header/footer or a single legacy value.
3131
- **CSS-style margins (TRBL)** with per-placement overrides and shorthand.
32-
- Date/time formatting (via `date-format`, `time-format`).
32+
- **Timezone-aware date/time rendering** (local, UTC, source, or fixed offset).
3333
- Optional **hyperlinks** for commit and branch to your remote provider.
3434
- Branch verification with graceful fallback to `"main"`.
3535
- Only the `html` renderer is supported.
@@ -70,10 +70,13 @@ footer = true # default: true
7070
font-size = "0.9em"
7171
separator = ""
7272
date-format = "%Y-%m-%d"
73-
time-format = "%H:%M"
73+
time-format = "%H:%M:%S"
7474
branch = "main"
7575
hyperlink = true # make hash/branch clickable when possible
7676

77+
# optional timezone handling
78+
timezone = "local" # "local" (default) | "utc" | "source" | "fixed:+02:00"
79+
7780
[preprocessor.gitinfo.message]
7881
footer = "Built {{date}}{{sep}}commit: {{hash}}"
7982
```
@@ -84,6 +87,21 @@ footer = "Built {{date}}{{sep}}commit: {{hash}}"
8487

8588
You can configure options either with **dotted keys** under `[preprocessor.gitinfo]` or with nested **tables** like `[preprocessor.gitinfo.message]`. Use **one style consistently** for readability; both work and merge as expected.
8689

90+
### Timezone
91+
92+
The new timezone option controls how commit timestamps are rendered.
93+
94+
| Value | Description |
95+
| -------------------------------- | -------------------------------------------------------- |
96+
| `local` *(default)* | Convert to system local time. |
97+
| `utc` | Convert to Coordinated Universal Time (UTC). |
98+
| `source` | Use the commit’s recorded timezone offset (as authored). |
99+
| `fixed:+HH:MM` or `fixed:-HH:MM` | Force a specific fixed offset. |
100+
| *anything else* | Emits a warning and falls back to `local`. |
101+
102+
>[!NOTE]
103+
>The offset is always applied, but not shown unless you include `%z`, `%:z`, or `%Z` in your time-format
104+
87105
### Message templates
88106

89107
**Placeholders:** `{{hash}}`, `{{long}}`, `{{tag}}`, `{{date}}`, `{{sep}}`, `{{branch}}`
@@ -196,6 +214,7 @@ With the configuration above, a footer will be injected similar to:
196214
<footer class="gitinfo-footer" style="font-size:0.8em;padding:4px;margin:2em 0 0 0;text-align:center;display:block;">
197215
branch: <b><a href="somelinktosomeawesomerepo">main</a></b> • commit: <a href="somelinktosomeawesomerepo">9296b47</a>
198216
</footer>
217+
199218
```
200219

201220
> The preprocessor inserts blank lines around injected blocks so Markdown headings/paragraphs render correctly.

0 commit comments

Comments
 (0)