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:
- Parsing - YAML frontmatter and body extraction from Markdown
- Templating - MiniJinja-based composition with backend-registered filters
- Backend Processing - Compilation of composed content to final artifacts
§Core Components
Quillmark
- High-level engine for managing backends and quillsWorkflow
- Sealed rendering API for executing the render pipelineQuillRef
- 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§
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
- Parsed
Document - A parsed markdown document with frontmatter
- Quill
- A quill template bundle.
- Render
Result - Result type containing artifacts and warnings
Enums§
- Output
Format - Output formats supported by backends.
- Parse
Error - Error type for parsing operations
- Render
Error - Main error type for rendering operations
- Severity
- Error severity levels
- Template
Error - 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