pub struct GitInfoConfig {Show 18 fields
pub enable: Option<bool>,
pub format: Option<String>,
pub template: Option<String>,
pub header: Option<bool>,
pub footer: Option<bool>,
pub message: Option<MessageConfig>,
pub font_size: Option<String>,
pub separator: Option<String>,
pub date_format: Option<String>,
pub time_format: Option<String>,
pub timezone: Option<String>,
pub datetime_format: Option<String>,
pub show_offset: Option<bool>,
pub branch: Option<String>,
pub align: Option<AlignSetting>,
pub margin: Option<MarginConfig>,
pub tag: Option<String>,
pub hyperlink: Option<bool>,
}Expand description
Represents the user-defined configuration options under [preprocessor.gitinfo]
in book.toml.
Each field is optional; defaults are handled in the preprocessor logic. The configuration allows users to control how commit metadata is formatted and rendered in the generated book.
Fields§
§enable: Option<bool>Gate to turn the preprocessor on/off without removing the section. Default: true (when omitted).
format: Option<String>The formatting style of the git data (currently unused, reserved for future use).
template: Option<String>Template string defining how git metadata is rendered.
Supported placeholders:
{{hash}}→ short commit hash{{long}}→ full commit hash{{tag}}→ lastest tag or user defined{{date}}→ commit date{{sep}}→ separator string (Deprecated) Old single template. If present, used as a fallback for footer_message.
header: Option<bool>§message: Option<MessageConfig>Message templates in a table: message.header/message.footer/message.both
font_size: Option<String>CSS font size for the rendered footer text.
Default: "0.8em".
separator: Option<String>String separator inserted between elements (e.g., date and hash).
Default: " • ".
date_format: Option<String>Format string for the date component.
Uses the chrono crate formatting syntax.
Default: "%Y-%m-%d".
time_format: Option<String>Format string for the time component.
Uses the chrono crate formatting syntax.
Default: "%H:%M:%S".
timezone: Option<String>§datetime_format: Option<String>§show_offset: Option<bool>§branch: Option<String>Git branch from which to retrieve commit history.
Default: "main".
align: Option<AlignSetting>Flexible align
- align = “center”
- align.header = “left”, align.footer = “right”
- [preprocessor.gitinfo.align] both = “center”
margin: Option<MarginConfig>CSS option to adjust margin between body and footer
tag: Option<String>§hyperlink: Option<bool>CSS option provides a hyperlink to the respective branch and commit
in the footer
Options: “true | false”
Default: false.