pub struct GitInfoConfig {Show 25 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>,
pub contributors: Option<bool>,
pub contributors_title: Option<String>,
pub contributors_message: Option<String>,
pub contributors_source: Option<ContributorsSource>,
pub contributors_file: Option<String>,
pub contributors_exclude: Option<Vec<String>>,
pub contributors_max_visible: Option<usize>,
}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.
contributors: Option<bool>Git Contributor switch
contributors_title: Option<String>Optional title for the contributors block.
Default: “Contributors:”
contributors_message: Option<String>Optional message that can be set under the title
Default: “”
contributors_source: Option<ContributorsSource>Where to source contributors from.
Options: “git” (default), “file”, “inline”
- git: derive from
git shortlog -sne --all - file: read from CONTRIBUTORS.md (or contributors-file)
- inline: only
{% contributors a b %}tokens are used
contributors_file: Option<String>File path (relative to book root) used when contributors-source = “file”. Default: “CONTRIBUTORS.md”
contributors_exclude: Option<Vec<String>>List of contributor author names to exclude.
Matches against the git author name (treated as GitHub username).
Example: contributors-exclude = [“github-actions[bot]”, “template-author”]
contributors_max_visible: Option<usize>Maximum number of contributor avatars shown before collapsing into a “Show all” expander. Default: 24