Skip to main content

compile_html

Function compile_html 

Source
pub fn compile_html(theme: &Theme, data: &Value) -> Result<String, RenderError>
Expand description

Compile a Theme bundle to a single-file HTML document against a JSON Resume value.

Mirrors compile_theme and compile_text but produces an HTML string via the typst-html exporter, using the same [FerrocvWorld] and the same Typst compilation path. HTML compilation therefore inherits the same constitutional guarantees — no subprocess (§2), no network (§6.1), no extended sandbox capabilities (§6.4).

The returned string is a complete HTML document, starting with <!DOCTYPE html>. Typst emits a single self-contained file — no external CSS, fonts, or images — so there is no post-processing step. See research/44-html-viability.md §5 for the evidence.

§Experimental upstream status

Typst labels its HTML export “experimental” and explicitly warns against production use. ferrocv’s --format html CLI surface is stable; the output shape emitted by this function may shift across Typst minor bumps. See the module-level “Experimental upstream status” section.

§Errors

Returns the same RenderError type as the PDF path; Typst compilation diagnostics flow through the shared diagnostics_to_error helper unchanged. HTML-specific rejections (e.g. link("") being fatal in HTML mode where PDF tolerated it for some theme sources) surface as plain compile errors here.