Tweag.Topiary

Tweag·Tweag.Topiary

Topiary aims to be a uniform formatter for simple languages, as part of the Tree-sitter ecosystem. It is named after the art of clipping or trimming trees into fantastic shapes.

Topiary is designed for formatter authors and formatter users. Authors can create a formatter for a language without having to write their own formatting engine or even their own parser. Users benefit from uniform code style and, potentially, the convenience of using a single formatter tool, across multiple languages over their codebases, each with comparable styles applied.

winget install --id Tweag.Topiary --exact --source winget

Latest 0.8.0·October 1, 2026

Release Notes

Release Notes

Full list of changes

Changed

• #1032 Replaced the topiary-core test and benchmark dependencies on the tree-sitter-json and tree-sitter-nickel grammar crates with dynamic loading via topiary-config. • #1277 Small internal refactoring of the core formatting logic. • #1172 Split out mdbook-manmunge into its own repository. • #1174 Split out the Topiary Playground into its own repository. • #1191 Split out the Topiary website into its own repository. • #1226 Query files moved from queries/<lang>.scm to queries/<lang>/formatting.scm in preparation for language injection support. The old flat layout is still supported as a fallback. • #1232 Rework topiary_core::ErrorSpan to handle QueryErrors as well as Node errors by introducing rootcause::Report • #1249 Remove async calls and setup from format_nickel benchmark • #1254 Topiary now gracefully skips formatting for unknown or unsupported injected languages instead of returning a fatal error, allowing files with unconfigured code blocks (like Markdown) to format successfully. • #1267 Add initial injection support (JSON) for Rust • #1270 Add initial languages.ncl Nickel contracts • #1139 Added rootcause::Report handling in topiary-cli. • #1283 Render Nickel parsing error diagnostics • #1298 Update WIT formatter for tree-sitter-wit to v1.4 • #1303 Add bin/verify-documented-usage.sh --no-nix-shell flag • #1306 Move topiary-cli configuration logic into its own module • #1311 Use #set! directive for injection.language property • #1328 #1335 Breaking: A relative grammar.source.path or queries.<name>.source.path in a configuration is now resolved against the directory of the languages.ncl that defined it, rather than against the working directory. A path accompanied by a git source is unaffected:it remains relative to the checkout root. • #1335 Nickel's evaluation warnings, previously discarded, are now reported through Topiary's logger.

Fixed

• #1176 Increase the stack size to 4MiB in Windows builds. • #1253 Handle linebreak preservation in OpenSCAD let chains • #1255 Unpinned outdated wasm-bindgen dependency • #1287 #1296 Various OCaml issues and improvements • #1291 Improve warning for injection queries without content captures • #1322 Improve error message when Topiary cannot find a query file • #1325 Fix regression with --query value parsing in topiary format • #1339 Handle edge cases in path resolution and cache query fetching

Added

• #1200 Build and deploy Topiary Docker images to ghcr.io. • #1217 Add --check flag to topiary fmt for CI formatting verification. • #1227 Add @append_empty_input_softline and @prepend_empty_input_softline captures, thanks to @BirdeeHub • #1244 Add language injection support for injection languages known at query writing. • #1254 Add Markdown formatting support with dynamic language injections for fenced code blocks (via the @injection.language capture). • #1279 Added experimental formatting support for the Menhir language. • #1299 Add QuerySource config fetching to topiary-config. • #1312 Added bin/changelog.nu to automatically add entry to CHANGELOG.md • #1315 Add rootcause-backtrace to cli • #1314 Allow skipping of formatting stages • #1266 Add @multi_line_string capture to format multi line strings in languages like Nix and Nickel that ignore indentation common to all lines of a multi line string. And use @multi_line_string to add multi line string formatting to the Nickel formatter. • #1330 Add a new feature flag on the topiary-core crate to enable the log dependency; this feature flag is enabled by default. Thanks to @GrandChaman.

Removed

• #1217 The check alias for the check-grammar subcommand, to avoid confusion with topiary fmt --check.

Install topiary-cli 0.8.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/topiary/topiary/releases/download/v0.8.0/topiary-cli-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -ExecutionPolicy Bypass -c "irm https://github.com/topiary/topiary/releases/download/v0.8.0/topiary-cli-installer.ps1 | iex"

Download topiary-cli 0.8.0

File Platform Checksum
topiary-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
topiary-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
topiary-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
topiary-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
topiary-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

Installer type: zip

x64—FD2411037A0CC85715225E5968038DB067F3833965041CBCF1BABEDFEF7FD8E1

Details

Homepage
https://github.com/tweag/topiary
License
MIT
Publisher
Tweag
Support
https://github.com/tweag/topiary/issues
Moniker
topiary

Tags

tree-sitter

Older versions (3)

0.7.3
x64—1580DA0ACA0A3B6A71D28FEF97FF2D5B012186F54C396CB9105A537C7F6D0EB9
0.6.1
x64—8B64B72E3B5411EAECD917D4B379B52BF0C92B2C71C5254E3D69D7F46B271159
0.6.0
x64—0BA1B938DF3E37BE8B2752EEC4D27BC74D709711E6F8EE52406FB7B68AC4FC32