Crate quillmark

Crate quillmark 

Source
Expand description

§Quillmark

Quillmark is a flexible, template-first Markdown rendering system that converts Markdown with YAML frontmatter into various output artifacts (PDF, SVG, TXT, etc.).

§Overview

Quillmark uses a sealed engine API that orchestrates the rendering workflow through three main stages:

  1. Parsing - YAML frontmatter and body extraction from Markdown
  2. Templating - MiniJinja-based composition with backend-registered filters
  3. Backend Processing - Compilation of composed content to final artifacts

§Core Components

  • Quillmark - High-level engine for managing backends and quills
  • Workflow - Sealed rendering API for executing the render pipeline
  • QuillRef - Ergonomic references to quills (by name or object)
  • Quill - Template bundle containing glue templates and assets

§Quick Start

use quillmark::{Quillmark, Quill, OutputFormat, ParsedDocument};

// Create engine with auto-registered backends
let mut engine = Quillmark::new();

// Load and register a quill template
let quill = Quill::from_path("path/to/quill").unwrap();
engine.register_quill(quill);

// Parse markdown
let markdown = "---\ntitle: Hello\n---\n# Hello World";
let parsed = ParsedDocument::from_markdown(markdown).unwrap();

// Create a workflow and render
let workflow = engine.workflow_from_quill_name("my-quill").unwrap();
let result = workflow.render(&parsed, Some(OutputFormat::Pdf)).unwrap();

// Access the rendered artifacts
for artifact in result.artifacts {
    println!("Generated {} bytes of {:?}", artifact.bytes.len(), artifact.output_format);
}

§Dynamic Assets

Workflows support adding runtime assets through a builder pattern:

let workflow = engine.workflow_from_quill_name("my-quill").unwrap()
    .with_asset("chart.png", vec![/* image bytes */]).unwrap()
    .with_asset("data.csv", vec![/* csv bytes */]).unwrap();

let result = workflow.render(&parsed, Some(OutputFormat::Pdf)).unwrap();

§Features

  • typst (enabled by default) - Typst backend for PDF/SVG rendering

§Re-exported Types

This crate re-exports commonly used types from quillmark-core for convenience.

Re-exports§

pub use orchestration::QuillRef;
pub use orchestration::Quillmark;
pub use orchestration::Workflow;

Modules§

orchestration
Orchestration

Structs§

Artifact
An artifact produced by rendering.
Diagnostic
Structured diagnostic information
Glue
Glue class for template rendering - provides interface for backends to interact with templates
Location
Location information for diagnostics
ParsedDocument
A parsed markdown document with frontmatter
Quill
A quill template bundle.
RenderResult
Result type containing artifacts and warnings

Enums§

OutputFormat
Output formats supported by backends.
ParseError
Error type for parsing operations
RenderError
Main error type for rendering operations
Severity
Error severity levels
TemplateError
Error types for template rendering

Constants§

BODY_FIELD
The field name used to store the document body

Traits§

Backend
Backend trait for rendering different output formats

Functions§

decompose
Decompose markdown into frontmatter fields and body