GitInfoConfig

Struct GitInfoConfig 

Source
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>§footer: 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.

Trait Implementations§

Source§

impl Debug for GitInfoConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GitInfoConfig

Source§

fn default() -> GitInfoConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GitInfoConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,