@@ -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
7070font-size = " 0.9em"
7171separator = " • "
7272date-format = " %Y-%m-%d"
73- time-format = " %H:%M"
73+ time-format = " %H:%M:%S "
7474branch = " main"
7575hyperlink = 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 ]
7881footer = " Built {{date}}{{sep}}commit: {{hash}}"
7982```
@@ -84,6 +87,21 @@ footer = "Built {{date}}{{sep}}commit: {{hash}}"
8487
8588You 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