Skip to content

perakasem/typstify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typstify

A live Typst snippet renderer for macOS. Type equations and diagrams — see a rendered preview instantly and export to PNG.

Install

Download Typstify.dmg from the latest release, open it, and drag Typstify to Applications.

First launch: macOS will block the app because it is not notarized. To open it anyway:

  • Right-click Typstify.appOpenOpen

Or run once in Terminal:

xattr -dr com.apple.quarantine /Applications/Typstify.app

Features

  • Equation mode — type raw Typst math; rendered wrapped in $...$
  • Diagram mode — full Typst source with CeTZ, Fletcher, and Plotst pre-imported
  • Live preview with configurable render quality (96 – 576 ppi)
  • Transparent background export (preserves alpha in PNG)
  • Symbol autocomplete for Greek letters, arrows, operators, and more
  • Auto-closing brackets, dollar signs, and quotes
  • Line numbers with compiler-aligned offsets
  • Light / dark / system appearance
  • ⌘F find bar, ⌘, settings

Build

Prerequisites

Tool Version
macOS 14 Sonoma or later
Xcode / Swift toolchain 15+ (Swift 5.9+)
Rust + Cargo stable

1 — Build the render server

cd src-tauri
cargo build --bin typstify-server --no-default-features

The binary lands at src-tauri/target/debug/typstify-server.

2 — Run the macOS app

cd typstify-native
swift run

Or build a release binary:

swift build -c release
.build/release/typstify-native

The app looks for the render server at the hardcoded debug path by default. Override with the environment variable:

TYPSTIFY_SERVER=/path/to/typstify-server swift run

Project structure

typstify/
├── src-tauri/              # Rust render server
│   └── src/
│       ├── server.rs       # stdin/stdout JSON-RPC loop
│       └── ...             # Typst compile + render logic
└── typstify-native/        # SwiftUI macOS app
    └── Sources/
        ├── TypestifyApp.swift
        ├── ContentView.swift       # Main UI, modes, toolbar
        ├── CodeEditorView.swift    # NSTextView wrapper, line numbers
        ├── SymbolCompletion.swift  # Autocomplete popup
        ├── TypstRenderer.swift     # Process management, JSON parsing
        └── SettingsView.swift      # Preferences (⌘,)

Render server protocol

The app spawns typstify-server as a subprocess and communicates over stdin/stdout with newline-delimited JSON.

Request:

{ "source": "#set page(...)\n$ e^{i\\pi}+1=0 $", "pixel_per_pt": 4.0 }

Response:

{
  "success": true,
  "pages": ["data:image/png;base64,..."],
  "diagnostics": [{ "severity": "warning", "message": "...", "span": "line 3" }]
}

Pages are base64-encoded PNG data URLs. The app decodes them to NSImage for preview and raw Data for export (preserving alpha).


Default diagram imports

Diagram mode pre-imports:

#import "@preview/cetz:0.4.2": canvas, draw, tree
#import "@preview/fletcher:0.5.8": diagram, node, edge
#import "@preview/plotst:0.2.0": *

These can be edited in the collapsible page config section.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors