pub struct Style {Show 72 fields
pub schema_version: u32,
pub page_width: f32,
pub page_height: f32,
pub margin_x: f32,
pub margin_y: f32,
pub page_layout: PageLayoutStyle,
pub pad_to_even: bool,
pub pad_to_multiple: u32,
pub body_font_size: f32,
pub body_line_height: f32,
pub paragraph_space_after: f32,
pub text_color: ColorRgb,
pub text_align: TextAlign,
pub link: LinkStyle,
pub heading: HeadingStyles,
pub heading_numbering: HeadingNumbering,
pub list_indent: f32,
pub list_item_space_after: f32,
pub list_marker_gap: f32,
pub list_marker: ListMarkerStyle,
pub blockquote_indent: f32,
pub blockquote_bar_width: f32,
pub blockquote_bar_color: ColorRgb,
pub blockquote_text_color: ColorRgb,
pub code_font_family: String,
pub code_font_size: f32,
pub code_padding: f32,
pub code_background: ColorRgb,
pub code_text_color: ColorRgb,
pub code_highlight: CodeHighlightStyle,
pub callout_padding: f32,
pub callout_accent_width: f32,
pub callout_styles: CalloutStyles,
pub callout_space_after: f32,
pub callout_label_size: f32,
pub callout_icon_size: f32,
pub callout_icon_gap: f32,
pub callout_rule_thickness: f32,
pub rule_color: ColorRgb,
pub rule_thickness: f32,
pub rule_space_around: f32,
pub toc: TocStyle,
pub lof: ListSectionStyle,
pub lot: ListSectionStyle,
pub pdf_export: PdfExportProfile,
pub page_decoration: PageDecorationStyle,
pub caption_position: CaptionPosition,
pub caption_color: Option<ColorRgb>,
pub figure_caption_prefix: String,
pub table_caption_prefix: String,
pub caption_separator: String,
pub image_title_fallback: bool,
pub table_column_sizing: TableColumnSizing,
pub table_column_weights: Vec<f32>,
pub table_borders: TableBorders,
pub table_cell_padding: f32,
pub table_border_color: ColorRgb,
pub table_border_thickness: f32,
pub table_edge_color: Option<ColorRgb>,
pub table_edge_thickness: Option<f32>,
pub table_header_background: ColorRgb,
pub table_header_text_color: ColorRgb,
pub table_stripe_color: Option<ColorRgb>,
pub table_header_column: bool,
pub table_space_after: f32,
pub footnote: FootnoteStyle,
pub watermark: Option<Watermark>,
pub font_paths: Vec<String>,
pub body_font_families: Vec<String>,
pub hyphenation: HyphenationStyle,
pub coverpage: CoverPageStyle,
pub frontmatter_tables: BTreeMap<String, FrontmatterTable>,
}Fields§
§schema_version: u32Schema-version stamp; reserved for future incompatible bumps.
page_width: f32§page_height: f32§margin_x: f32§margin_y: f32§page_layout: PageLayoutStyleMulti-column body layout (1 = single column, the default).
pad_to_even: boolWhen the rendered document ends on an odd page, append one page so
the physical total is even. Intended for duplex (double-sided)
printing, where each new document should begin on the front of a
fresh sheet. The padding page carries the running header / footer
(and watermark) like any other page but has no body content, and it
is counted in the {total} page-of total. Off by default.
Ignored when [pad_to_multiple] is greater than 1.
pad_to_multiple: u32Append blank pages (header / footer / watermark only) until the
physical page count is a multiple of this value. 0 or 1 leaves
the count unchanged. 4 is the booklet / saddle-stitch case (four
pages per folded sheet). Counts toward {total}. When set, it
supersedes [pad_to_even].
body_font_size: f32§body_line_height: f32§paragraph_space_after: f32§text_color: ColorRgb§text_align: TextAlignHorizontal alignment for body prose (paragraphs, list-item and
callout bodies). Headings, captions and table cells are
unaffected. Defaults to left; justify spreads every line but
the last to the column width.
link: LinkStyleHow [text](url) links are visually distinguished from body
text. The PDF link annotation is created regardless; this is
purely the visual cue so a reader spots the link before they
hover over it.
heading: HeadingStyles§heading_numbering: HeadingNumberingAutomatic 1 / 1.1 / 1.1.1 section numbering. Off by default.
list_indent: f32§list_item_space_after: f32§list_marker_gap: f32§list_marker: ListMarkerStyle§blockquote_indent: f32§blockquote_bar_width: f32§blockquote_bar_color: ColorRgb§blockquote_text_color: ColorRgb§code_font_family: String§code_font_size: f32§code_padding: f32§code_background: ColorRgb§code_text_color: ColorRgb§code_highlight: CodeHighlightStylePer-token-class palette for the small built-in syntax
highlighter. Applies to fenced code blocks whose language
attribute is recognised.
callout_padding: f32§callout_accent_width: f32§callout_styles: CalloutStyles§callout_space_after: f32§callout_label_size: f32Font size (pt) for a callout’s bold label line.
callout_icon_size: f32Square draw size (pt) for a callout’s icon.
callout_icon_gap: f32Horizontal gap (pt) between the icon and the label / body column.
callout_rule_thickness: f32Stroke thickness (pt) for the rules of a decoration = "rules"
callout.
rule_color: ColorRgb§rule_thickness: f32§rule_space_around: f32§toc: TocStyle§lof: ListSectionStyle§lot: ListSectionStyle§pdf_export: PdfExportProfile§page_decoration: PageDecorationStyle§caption_position: CaptionPosition§caption_color: Option<ColorRgb>Colour for figure/table caption text. None falls back to
blockquote_text_color (the historical default); a per-caption
{% caption color="#…" %} overrides both.
figure_caption_prefix: StringPrefix used for figure caption labels — "<prefix> N" or
"<prefix> N: caption". Defaults to “Figure”; common alternates
include “Fig.”, “Image”, localised forms, etc.
table_caption_prefix: StringPrefix for table caption labels. Defaults to “Table”; common alternates include “Tab.”.
caption_separator: StringSeparator between the numbered prefix and the caption text (when present). Defaults to “:”.
image_title_fallback: boolWhen true, an image’s title attribute (from {% media title="…" /%}
or markdown ) is used as the caption /
accessibility text when neither an explicit {% caption %} nor alt
is present. Off by default — title is otherwise ignored in the PDF,
since it has no natural print rendering.
table_column_sizing: TableColumnSizing§table_column_weights: Vec<f32>Explicit relative column widths. When set and the count matches a
table’s column count, the table’s inner width is split in these
proportions (weights, not absolute units — [1.0, 3.0] makes the
second column three times the first) and table_column_sizing is
ignored for that table. Ideal for key/value metadata tables where a
fixed-width label column reads better than content-based sizing.
Empty (the default) leaves every table on automatic sizing.
table_borders: TableBordersWhich rules the table draws: a full grid (default), only
horizontal row separators, or none.
table_cell_padding: f32§table_border_color: ColorRgb§table_border_thickness: f32§table_edge_color: Option<ColorRgb>Colour of the table’s outer frame — the top/bottom rules (and the
left/right rules in grid mode). Unset means edges match the
internal table_border_color; a darker edge gives a booktabs look.
table_edge_thickness: Option<f32>Thickness of those outer rules; defaults to table_border_thickness.
table_header_background: ColorRgb§table_header_text_color: ColorRgb§table_stripe_color: Option<ColorRgb>Background fill for alternating body rows (zebra striping); applied
to every other body row. None (the default) disables it. A table
can override it with the {% table stripe="#rrggbb" %} attribute,
or stripe="none" to switch striping off for that one table.
table_header_column: boolTreat the first column as a header column (row headers): its cells
render in the header text style (bold, table_header_text_color)
over a table_header_background fill, and are tagged as row headers
for accessibility. Off by default; set per table with
{% table header_column=true %}. Independent of the header row, so
a table can have both.
table_space_after: f32§footnote: FootnoteStyle§watermark: Option<Watermark>Optional watermark drawn beneath every page’s body content. Use
for letterhead images, “DRAFT” diagonals, confidentiality
markings, etc. Tagged as Artifact so screen readers ignore it.
font_paths: Vec<String>File paths to additional .ttf/.otf fonts that should be
loaded into the font collection before laying out the document.
Any family they expose can then be referenced via font_families
just like the bundled Noto family. Loaded once at the start of
the render — paths are not re-checked.
body_font_families: Vec<String>Family names used for body text (in fallback order). Empty list
means “use the bundled defaults” (Noto Sans + the multi-script
Noto fallbacks). Pass family names registered by your own
font_paths to swap in a custom typeface.
hyphenation: HyphenationStyle§coverpage: CoverPageStyleSynthesised cover page rendered before any body content. Drawn from frontmatter (title, description, authors, date) plus an optional logo. Source documents stay output-agnostic — all cover-page knobs live here in the style.
frontmatter_tables: BTreeMap<String, FrontmatterTable>Tags that stand for a table built from the document’s frontmatter,
keyed by tag name. Each {% <name> /%} in the composed document
(partials and sections included) becomes a level-2 heading and a
table, one row per map in the frontmatter list the entry names.
Empty by default: a tag named nowhere here renders as Markdoc
renders it, which for a self-closing tag is nothing.
[frontmatter_tables.document-history]
key = "documentHistory"
heading = "Document history"
columns = [
{ field = "version", header = "Version" },
{ field = "date", header = "Date" },
{ field = "description", header = "Description" },
]Implementations§
Source§impl Style
impl Style
pub fn from_toml_str(s: &str) -> Result<Self, Error>
pub fn from_toml_file(path: impl AsRef<Path>) -> Result<Self, StyleLoadError>
Sourcepub fn padding_multiple(&self) -> usize
pub fn padding_multiple(&self) -> usize
Page-count multiple used for trailing blank pages. pad_to_multiple
wins when it is greater than 1; otherwise pad_to_even means 2.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Style
impl<'de> Deserialize<'de> for Style
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for Style
impl Freeze for Style
impl Move for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.