Tern

Tern is a batch conversion tool for projects that turn source files into outputs: Markdown into HTML pages, diagrams into SVG, documents into PDF. It scans source directories, runs each changed file through a Lua converter that calls the real tool (pandoc, mmdc, ImageMagick, …), and writes the result to a mirrored output tree. Conversions are packaged as templates installed from Git repositories, so a project declares what it builds in one config file and reproduces it anywhere with tern -u.

flowchart LR
    CFG[.tern/config.toml<br/>templates + overrides] -->|tern -u| INST
    subgraph INST [Installed templates]
        CONV[Lua converters]
        DATA[Template data]
        DB[(Profiles + pipelines)]
    end
    SRC[Source tree] -->|tern| RUN[Pipelines]
    INST --> RUN
    RUN -->|changed files only| OUT[Output tree]

Documentation

The documentation index links every page:

Quick start

Add tern to a project’s development shell through the flake (reference Installation), then declare a template in .tern/config.toml:

[[templates]]
name = "pandoc-template"
url = "https://git.yhkze.net/tern/pandoc-template.git"

Install the templates it lists, which clones them and derives their profiles and pipelines:

tern -u

Convert every changed source file (for this template, docs/**/*.md into docs-html/):

tern

Repository layout

core/                 tern-core: engine, templates, pipelines, SQLite store, migrations
tui/                  tern: ratatui frontend over core
docs/                 Documentation source (Markdown)
docs-html/            Compiled HTML (generated by tern)
.tern/config.toml     pandoc-template installs that compile docs/ and this README
.forgejo/workflows/   CI: checks, release, binary cache
flake.nix             Packages (tern, tern-core) and dev shells (default, docs)
AGENTS.md             Guidance for coding agents

Releases

Every push to master with a feat:, fix:, perf: or breaking commit releases a new version: CI tests it, pushes both binaries to the yuuhikaze Cachix cache and tags it. Reference Contributing.

License

MIT