mdcast-api
Shared data types and HTTP wire protocol for mdcast — serde-only, no engine dependencies.
This crate exists so that mdcast-client
(and any other embedder of the protocol) can speak to mdcast-server without
compiling the rendering engines: no typst, no vendored reveal.js tree, no
pandoc plumbing. Its default dependency set is serde, full stop.
What's in it
- Document types —
Target(docx / odt / pptx / html-reveal / pdf / pdf-presentation),DocMeta,BrandSpecand the auto-layout rule types. - Content addressing —
Digest(validated lowercase-hex sha256) andAssetManifest(asset key → digest). - Wire protocol (
wiremodule) — request/response bodies formdcast-server's endpoints:RenderMarkdownRequest/RenderOptions,RenderTemplateRequest/TemplateFormat,BlobCheckRequest/BlobCheckResponse,MissingBlobsError(the409body),CapabilitiesResponse, andErrorResponse/ErrorCodefor every other 4xx/5xx.
The protocol in one paragraph
A render request carries an AssetManifest naming every asset it may touch.
The server checks the whole manifest up front; if it lacks any blobs it
answers a single 409 listing all of them, the caller uploads exactly those
(multipart, part name = digest, server re-hashes every byte), and retries the
identical request. Content addressing means a stored blob can never be stale
— eviction is invisible, a 409 just means "upload it again".
Feature flags
toml(off by default) —BrandSpec::from_toml, for callers that have abrand.tomlbut must not compilemdcastitself.
Related crates
mdcast— the rendering library, CLI, and (behind itsserverfeature) themdcast-serverbinary.mdcast-client— async client with the manifest negotiation folded into one call.