markplus_render
HTML and PDF renderer for the MarkPlus ecosystem.
Consumes a SiteAsset (schema + frontmatter + AST) produced by markplus_core and emits:
| Target | How |
|---|---|
| HTML | AST → Tera *.html.tera template → .html string |
| Typst source | AST → Tera *.typ.tera template → .typ string |
| PDF (native) | Typst source → typst-as-lib → PDF bytes |
| PDF (wasm) | Typst source → embedded WasmWorld → PDF bytes (--features wasm, ~30 MB) |
Quick start
use parse_document;
use RenderEngine;
let asset = parse_document?;
let engine = builder.build?; // loads templates/ dir
let html = engine.render_html?;
let typst_src = engine.render_typst_string?;
let pdf_bytes = engine.compile_pdf?;
Feature flags
| Feature | Default | Description |
|---|---|---|
| (none) | ✓ | Native HTML + Typst + PDF |
wasm |
off | Adds wasm-bindgen exports + in-browser PDF via embedded fonts |
Template directory
Default templates live in templates/default/:
templates/
└── default/
├── article.html.tera ← HTML article
└── article.typ.tera ← Typst article (→ PDF)
Override at runtime:
let engine = builder
.with_templates
.build?;
PDF pipeline
Markdown → markplus_core → SiteAsset
│
render_typst_string()
│
.typ source
│
┌─────────────┴─────────────┐
│ native │ wasm
typst-as-lib WasmWorld
+ system fonts + Liberation fonts
│ │
└──────────── PDF bytes ────┘
Example
# Writes my_note.html, my_note.typ, my_note.pdf
License
Apache-2.0