Skip to main content

Crate adocers_typst

Crate adocers_typst 

Source
Expand description

The PDF back end: a document becomes Typst markup, and Typst makes the PDF.

Typst is a typesetting system written in Rust, so it compiles in beside everything else and a PDF needs no LaTeX installation, no headless browser and nothing fetched. Its fonts are the ones Typst itself embeds, so the result does not depend on what the machine happens to have.

This is a second back end rather than a variation on the first. The HTML one walks the block tree emitting markup, and so does this, but Typst is not HTML and almost nothing is shared between them — the exception being inline content, which the parser hands over as HTML whatever is going to be done with it. inline translates that. What the two back ends genuinely agree on — section numbers, header metadata, admonition icons, mermaid diagrams — lives in adocers_render_core, which neither of them owns.

What it covers is the shape of an ordinary document: headings, paragraphs, lists, tables, listings, quotes, admonitions, images, diagrams, footnotes and breaks. A block it has no rendering for becomes its own text rather than a gap.

Equations are typeset rather than shown: LaTeX through mitex, AsciiMath rewritten into Typst’s own notation. When one will not lay out, every equation in the document is shown as its source instead — a page of equations as their source being a better answer than no page at all — and Pdf::fallback says so.

Three things stop short of the page and are documented as such: a table cell written as AsciiDoc comes out empty; a passthrough is dropped, being HTML; and a cross reference to anything but a section keeps its words and loses its link, because Typst will not lay out a document that points at a label it cannot find.

Structs§

Options
What a PDF shows beyond the document’s own content.
Pdf
A typeset PDF, and anything the caller ought to be told about how it was made.

Functions§

markup
The Typst markup for a document, and the image files it refers to.
pdf
Render document as a PDF.