Skip to main content

RenderContext

Struct RenderContext 

Source
pub struct RenderContext {
    pub title: String,
    pub language: Option<String>,
    pub description: Option<String>,
    pub authors: Vec<String>,
    pub creator: Option<String>,
    pub producer: Option<String>,
    pub creation_date: Option<DateTime>,
    pub date_string: Option<String>,
    pub vars: HashMap<String, String>,
    pub external_tagrefs: HashMap<String, ExternalTagref>,
}
Expand description

Caller-supplied context that the renderer can interpolate into header/footer template strings and surface as PDF document metadata.

Fields§

§title: String

Document title — substituted as {title} in header/footer templates and emitted as the PDF’s /Title metadata.

§language: Option<String>

Document language code (e.g. "en-us"). Required by PDF/A.

§description: Option<String>

Document description / abstract.

§authors: Vec<String>

Authors (combined into PDF /Author metadata).

§creator: Option<String>

Application that created the document.

§producer: Option<String>

Library / pipeline that wrote the PDF bytes (/Producer). Defaults to krilla’s own string when None. Set this to e.g. "markdoc-pdf 0.1.0" so support tooling can identify which version of the renderer produced a given file.

§creation_date: Option<DateTime>

Document creation date for the PDF metadata. If None, the renderer falls back to the current system time so PDF/A docs always carry a valid /CreationDate. Use dates::parse_iso to convert from a frontmatter ISO date string, or dates::now() to stamp the build time.

§date_string: Option<String>

String used for the {date} header/footer template variable. Defaults to today’s date in YYYY-MM-DD form. Override to supply a localised or differently-formatted date (e.g. "3 May 2026").

§vars: HashMap<String, String>

Caller-supplied template variables, looked up by name in header/footer and cover-page template strings ({my_var}) after the built-in tokens. Lets a caller surface arbitrary frontmatter (version, hardware revision, a pre-computed copyright year span, …) without the renderer knowing those field names. Unknown names are left as literal {name} so typos are visible.

§external_tagrefs: HashMap<String, ExternalTagref>

Website pages for {% tag %} ids. A {% tagref %} whose target is not declared in this PDF becomes a link to url.

Trait Implementations§

Source§

impl Clone for RenderContext

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderContext

Source§

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

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

impl Default for RenderContext

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.