Skip to main content

Module request

Module request 

Source
Expand description

Constructors for the two wire request bodies.

RenderMarkdownRequest and RenderTemplateRequest are plain serde structs in mdcast-api with no Default (markdown and target are not optional), so building one by hand means naming every field. These give the common case one expression; everything else is a struct-update:

use mdcast_client::request;
use mdcast_api::{Target, wire::RenderOptions};

let mut req = request::markdown("# Q3", Target::Pdf);
req.options = RenderOptions {
    mermaid: true,
    toc_depth: Some(2),
    ..RenderOptions::default()
};

The assets manifest is deliberately left empty: the client fills it from the crate::AssetBundle handed to the render call.

Functions§

markdown
Render markdown to target, with no brand and no options.
template
Render a typst template over data (raw JSON text, the bytes that become the virtual /data.json) to PDF.