RICH
Rich text document construction. Working format is RTF, built directly in Rust — no browser, no layout engine. Positions and sizes are in millimetres. A4 for documents. 16:9 for presentations (each page becomes a slide on export). LibreOffice headless is used only for outbound export.
[pending — deferred to dedicated session] — RICH is designed and specified. Implementation requires a dedicated session.
Document lifecycle
(* Open existing RTF *)
RICH OPEN "/root/report.rtf" SET ?doc
(* New blank A4 document *)
RICH NEW AS "A4" SET ?doc
(* New 16:9 presentation *)
RICH NEW AS "16:9" SET ?doc
(* Read full content *)
RICH READ ?doc SET ?content
(* Save to original path *)
RICH SAVE ?doc SET ?doc
(* Save to specific path *)
RICH SAVE ?doc INTO "/root/report.rtf" SET ?doc
Insert elements
(* Heading at line 1 — flow position *)
RICH INSERT ?doc WITH "Annual Report 2026" AS "heading-1"
AT LINE 1
FONT "Inter" SIZE 32 WEIGHT 700 COLOR "#0d1117"
SET ?doc
(* Paragraph *)
RICH INSERT ?doc WITH "This quarter we exceeded targets..." AS "paragraph"
AT LINE 2
FONT "Inter" SIZE 11 WEIGHT 400 WIDTH 160 LINE HEIGHT 1.6
SET ?doc
(* Image — absolute position in mm *)
RICH INSERT ?doc WITH "/root/logo.png" AS "image"
AT 10 BY 10
WIDTH 50 HEIGHT 20
SET ?doc
(* Table from OQL data *)
RICH INSERT ?doc WITH ?sales_data AS "table"
AT LINE 4
WIDTH 160
SET ?doc
(* Bar chart from {label, value} array *)
RICH INSERT ?doc WITH ?chart_data AS "bar-chart"
AT LINE 8
WIDTH 160 HEIGHT 80
COLOR "#0057FF"
SET ?doc
(* Rectangle shape *)
RICH INSERT ?doc WITH "rect" AS "shape"
AT 0 BY 0 WIDTH 210 HEIGHT 2
COLOR "#0057FF"
SET ?doc
(* Horizontal divider *)
RICH INSERT ?doc WITH "divider" AS "divider"
AT LINE 6
COLOR "#e0e0e0"
SET ?doc
Format and reposition
(* Bold and colour a text range *)
RICH FORMAT ?doc FROM LINE 2 COL 1 TO LINE 2 COL 20
WEIGHT 700 COLOR "#0057FF"
SET ?doc
(* Move element by id *)
RICH MOVE ?doc ELEMENT ?el(id) AT 100 BY 200 SET ?doc
(* Resize element by id *)
RICH RESIZE ?doc ELEMENT ?el(id) WIDTH 80 HEIGHT 40 SET ?doc
Export
RICH EXPORT ?doc AS "pdf" INTO "/root/report.pdf" SET ?path
RICH EXPORT ?doc AS "docx" INTO "/root/report.docx" SET ?path
RICH EXPORT ?doc AS "pptx" INTO "/root/slides.pptx" SET ?path
RICH EXPORT ?doc AS "html" SET ?html
Document object fields
| Field | Type | Description |
|---|---|---|
type | string | "document" or "presentation" |
page_size | string | "A4" or "16:9" |
pages | array | Array of page objects, each with an elements array |
path | string | Source file path — present when opened from a file |
Element types for RICH INSERT AS
| Type | Description |
|---|---|
"heading-1" through "heading-6" | Heading levels |
"paragraph" | Body paragraph |
"image" | Embedded image — WITH "/root/path.png" |
"table" | Table from array of objects |
"bar-chart" | Inline bar chart from {label, value} array |
"shape" | Shape — currently "rect" |
"divider" | Horizontal rule |