KosmoKrator

rendering

Typst Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Typst KosmoKrator integration.

1 functions 0 read 1 write No credentials auth

Lua Namespace

Agents call this integration through app.integrations.typst.*. Use lua_read_doc("integrations.typst") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Typst — Lua API Reference

render_typst

Render a Typst document to PDF. Pass valid Typst markup and get back a downloadable PDF link. Use this tool to generate formatted documents: reports, invoices, proposals, summaries, letters, tables, and more.

Parameters

NameTypeRequiredDescription
markupstringyesTypst markup content to compile into a PDF document.
titlestringnoDocument title used as link text (default: "Document").

Key Typst Syntax

  • = Heading for headings (== for h2, === for h3)
  • *bold* for bold, _italic_ for italic
  • #table(columns: ..., [...], [...]) for tables
  • #set page(margin: 2cm) for page settings
  • #set text(size: 12pt, font: "...") for text settings
  • - item for bullet lists, + item for numbered lists
  • #line(length: 100%) for horizontal rules
  • #align(center)[...] for alignment
  • #v(1em) for vertical spacing

Example

local result = app.integrations.typst.render_typst({
  markup = [[
#set page(margin: 2cm)
#set text(size: 11pt)

= Quarterly Report

== Summary

Revenue increased by *15%* compared to last quarter.

#table(
  columns: (1fr, 1fr, 1fr),
  [*Metric*], [*Q1*], [*Q2*],
  [Revenue], [$1.2M], [$1.38M],
  [Users], [12,000], [15,400],
)
]],
  title = "Quarterly Report"
})

print(result)
Raw agent markdown
# Typst — Lua API Reference

## render_typst

Render a Typst document to PDF. Pass valid Typst markup and get back a downloadable PDF link. Use this tool to generate formatted documents: reports, invoices, proposals, summaries, letters, tables, and more.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `markup` | string | yes | Typst markup content to compile into a PDF document. |
| `title` | string | no | Document title used as link text (default: `"Document"`). |

### Key Typst Syntax

- `= Heading` for headings (`==` for h2, `===` for h3)
- `*bold*` for bold, `_italic_` for italic
- `#table(columns: ..., [...], [...])` for tables
- `#set page(margin: 2cm)` for page settings
- `#set text(size: 12pt, font: "...")` for text settings
- `- item` for bullet lists, `+ item` for numbered lists
- `#line(length: 100%)` for horizontal rules
- `#align(center)[...]` for alignment
- `#v(1em)` for vertical spacing

### Example

```lua
local result = app.integrations.typst.render_typst({
  markup = [[
#set page(margin: 2cm)
#set text(size: 11pt)

= Quarterly Report

== Summary

Revenue increased by *15%* compared to last quarter.

#table(
  columns: (1fr, 1fr, 1fr),
  [*Metric*], [*Q1*], [*Q2*],
  [Revenue], [$1.2M], [$1.38M],
  [Users], [12,000], [15,400],
)
]],
  title = "Quarterly Report"
})

print(result)
```

Metadata-Derived Lua Example

local result = app.integrations.typst.render_typst({
  markup = "example_markup",
  title = "example_title"
})
print(result)

Functions

render_typst

Render a Typst document to PDF. Pass valid Typst markup and get back a downloadable PDF link. Use this tool to generate formatted documents: reports, invoices, proposals, summaries, letters, tables, and more. Example markup: ``` #set page(margin: 2cm) #set text(size: 11pt) = Quarterly Report == Summary Revenue increased by *15%* compared to last quarter. #table( columns: (1fr, 1fr, 1fr), [*Metric*], [*Q1*], [*Q2*], [Revenue], [$1.2M], [$1.38M], [Users], [12,000], [15,400], ) ``` Key Typst syntax: - `= Heading` for headings (`==` for h2, `===` for h3) - `*bold*` for bold, `_italic_` for italic - `#table(columns: ..., [...], [...])` for tables - `#set page(margin: 2cm)` for page settings - `#set text(size: 12pt, font: "...")` for text settings - `- item` for bullet lists, `+ item` for numbered lists - `#line(length: 100%)` for horizontal rules - `#align(center)[...]` for alignment - `#v(1em)` for vertical spacing

Operation
Write write
Full name
typst.render_typst
ParameterTypeRequiredDescription
markup string yes Typst markup content to compile into a PDF document.
title string no Document title used as link text (default: "Document").