README.md

# glypst

[![Package Version](https://img.shields.io/hexpm/v/glypst)](https://hex.pm/packages/glypst)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/glypst/)

A type-safe Gleam library for generating [Typst](https://typst.app) documents. Inspired by [Lustre](https://github.com/lustre-labs/lustre), glypst lets you build Typst documents using typed Gleam functions with attributes and content — just like Typst's own function model.

## Installation
```sh
gleam add glypst
```

## Usage
```gleam
import gleam/io
import glypst
import glypst/model
import glypst/text

pub fn main() {
  glypst.Sequence([
    model.heading([model.level(1)], [text.text("My Document")]),
    model.heading([model.level(2)], [text.text("Introduction")]),
    model.strong([], [text.text("Welcome to glypst. ")]),
    text.line_break(),
    model.bullet_list([model.marker(model.TextMarker("--"))], [
      text.text("Type safe"),
      model.strong([], [text.text("Fast")]),
      model.emph([], [text.text("Easy to use")]),
    ]),
  ])
  |> glypst.render()
  |> io.println()
}
```

Which outputs valid Typst markup:
```typst
#heading(level: 1)[My Document]
#heading(level: 2)[Introduction]
#strong[Welcome to glypst. ]

#list(marker: [--])[Type safe][#strong[Fast]][#emph[Easy to use]]
```

## Development
```sh
gleam test  # Run the tests
gleam docs build  # Build the documentation
```