syntect

High-quality Rust syntax highlighting using Sublime Text's grammar and theme formats

Library
Cargo
v5.3.0
2,430 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 8
Maintenance 32
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 82
Code Quality 85
Innovation 78
Learning Curve 70

syntect is a Rust library for syntax highlighting and basic code intelligence, built on top of Sublime Text’s .sublime-syntax grammar format and .tmTheme color schemes. Because it reuses the same battle-tested grammars Sublime Text ships with, it gets near-complete language coverage and correctness for free, including tricky edge cases like heredocs and deeply nested embedded languages.

The library exposes both a simple one-call API for common cases (highlight a string, get styled HTML or ANSI-escaped terminal output) and lower-level primitives — parse states, scope stacks, cacheable parser snapshots — that let text editors implement incremental re-highlighting as a user types, without re-parsing the whole file on every keystroke.

What You Get

  • A bundled, compressed dump of Sublime Text’s default syntax and theme definitions, ready to use out of the box
  • An easy API (HighlightLines) for one-shot highlighting of a string into styled spans
  • HTML output helpers (html module) for rendering highlighted code as <pre> blocks
  • ANSI 24-bit terminal escape output for CLI tools
  • Exposed internal parse state so editors can cache and incrementally re-highlight only the changed region of a file
  • A choice of regex engines — the default onig (Oniguruma) binding or a pure-Rust fancy-regex mode with no C dependency

Common Use Cases

  • Rendering syntax-highlighted code blocks in static site generators and documentation tools
  • Building terminal-based file viewers or cat-style tools with colorized code output
  • Implementing incremental re-highlighting in Rust-based text editors and IDEs
  • Generating highlighted HTML for code snippets in web applications and blogging platforms

Under The Hood

Architecture - syntect splits cleanly into a parsing module (src/parsing/) that interprets Sublime .sublime-syntax grammars into a scope-annotated token stream, and a highlighting module (src/highlighting/) that maps those scopes to a .tmTheme color theme; easy.rs composes the two into a single-call API, while html.rs and util.rs provide renderer helpers for HTML and ANSI terminal output respectively. dumps.rs handles serializing/deserializing pre-compiled syntax sets via bincode+flate2 so consumers don’t pay the cost of parsing every grammar file at startup.

Tech Stack - Rust 2021 edition, using onig (Oniguruma C bindings) or fancy-regex (pure Rust) as pluggable regex backends selected via Cargo features, serde/serde_derive for grammar/theme deserialization, yaml-rust2 for parsing YAML-based syntax files, thiserror for error types, and walkdir for scanning syntax directories. Feature flags let consumers opt out of parsing or highlighting independently to shrink dependency footprint.

Code Quality - The repo carries a substantial tests/ suite including snapshot tests (tests/snapshots), a dedicated error_handling.rs test file, and a public_api.rs test guarding against accidental breaking API changes via rustdoc-json/public-api. Combined with criterion benchmarks and years of production use (cited by at least two companies and many OSS editors), the codebase shows mature test discipline for a parsing-heavy library.

API Design - The library favors a layered API: easy::HighlightLines covers the 90% case in a few lines, while lower-level parsing::ParseState/highlighting::Highlighter primitives are exposed for advanced use like incremental re-highlighting caches — a deliberate trade-off that keeps the common path simple without hiding the internals editors need for performance-sensitive integrations.

Used by 5 apps in this directory

Rust
95%
MIT

claw-code

AI Agents · AI Code Assistants

195,291

A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.

View details
51
Repo Health
71
Technical
77
Dependency
Built with
Rust 95%
Updated 1 months ago
Rust
88%
GPL 2.0

Fresh

Code Editors · Developer Tools

9,052

A zero-configuration terminal text editor with familiar keybindings, full mouse support, LSP-powered IDE features, and a built-in orchestrator for running multiple coding agents in parallel worktrees.

View details
86
Repo Health
88
Technical
71
Dependency
Built with
Rust 88%
Updated 5 days ago
Rust
65%
Other

GitButler

AI Development · Developer Tools · Devops

21,726

Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.

View details
89
Repo Health
84
Technical
66
Dependency
Built with
Rust 65%
TypeScript 22%
Svelte 10%
Updated 4 days ago
Rust
43%
BSD 3

MicroBin

File Storage

4,571

A self-contained, encrypted paste bin and file-sharing app in Rust with animal-name URLs, burn-after-read, and one-command Docker deployment.

View details
56
Repo Health
67
Technical
71
Dependency
Built with
Rust 43%
HTML 28%
JavaScript 20%
Updated 3 weeks ago
Rust
97%
Apache 2.0

codex

AI Code Assistants · Developer Tools

126,822

OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.

View details
89
Repo Health
80
Technical
75
Dependency
Built with
Rust 97%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers