Library / SDK
trishume/syntect avatar
trishume/syntect

Syntect tells you which laptop its speed numbers came from, and which comparison is unfair

Rust library for syntax highlighting using Sublime Text syntax definitions.

2,467 stars190 forksRustMIT

At a glance

What is it?
A syntax highlighting library in Rust that reads Sublime's own grammar files, links a C regex engine by default, enforces its compatibility claim by diffing a test summary against a baseline, and publishes a documentation build with a feature you do not get by default.
Who is it for?
Syntect is the right choice if you are building a text editor in Rust and want Sublime's grammar coverage without vendoring a folder of syntax definitions, and the piece to understand is the regex engine, which is a C library by default and a compile-time choice you make rather than a runtime setting. Read the performance section rather than the feature list, because the numbers are dated to a 2012 laptop and the comparisons are explicitly caveated.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 26 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • trishume/syntect2,467 ★ · +32
Star history
Repository2026-09-302026-11-25
trishume/syntect2.4k2.5k

32 Stars in the last 56 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Mostly complete, still maintained, not under heavy development

The readme states its own maintenance posture in three clauses and it is worth quoting the substance rather than paraphrasing it. The author considers the project mostly complete, still maintains it, reviews pull requests, and is explicit that it is not under heavy development.

The invitation that follows is unusual: if you are writing a text editor in Rust and this library does not fit what you need, that is considered a bug, and you should file an issue or email him. That is a maintainer telling you the scope is a commitment rather than a description.

The dates are consistent with it. Three releases are visible, and the gaps between them are long: one in mid 2023, one in early 2024, and one in late 2025. The last commit to the default branch is dated 2026-04-28, so a few months of work sit above the newest tag.

The production claim is deliberately vague, by contrast. The readme says the library is used in production by at least two companies, without naming them, and then points at a long list of open source projects that use it. The open source list is the falsifiable half and the company count is the reassuring half, and the author has clearly decided the second does not need evidence.

For a dependency decision that combination works. The library is not going to change shape, and the person who wrote most of it is reachable.

The speed numbers name the machine they came from

This is the best written performance section in a Rust readme I have come across, and the reason is that it is written against itself.

Every measurement was taken on a mid 2012 fifteen inch laptop, and the author adds that a newer machine of his takes about seventy percent of those times. So you know both the floor and the direction.

The competitor figures are handled with more care than the author of most benchmarks would manage. Three of them were measured by hand with a stopwatch, which the readme says, so they are approximate and named as such. The fourth, the editor whose grammar this library actually uses, is given to the millisecond and described as highlighting-only with a separate figure for time to pixels. And the fifth comparison is excluded outright, on the grounds that the other editor's grammar is far more basic, with links to both grammar files so you can judge for yourself.

The own-numbers are as specific. Nine thousand two hundred lines of a popular library at two hundred and forty seven kilobytes takes six hundred milliseconds. A seventeen hundred line XML file takes thirty four. A thirty line test file takes one point nine. And the section opens by saying the numbers may improve if more of the checklist above is implemented, so the checklist is aspirational rather than a changelog.

Six of the seven performance items are ticked. The seventh is not, and it is the one that matters, which is the next section.

The default regex engine is a C library, and the alternative is documented as slower

One box in the performance list is unticked, and the reason is stated in the same sentence. The library can optionally use a different regex crate, but on the author's own benchmarks it is not yet faster than the engine already in use.

The engine already in use is oniguruma, a C library, and it is named twice in the list: once in the item about caching regex matches so that the C library is asked to search a given line fewer times, and once in the item about compiling regexes lazily so startup is not spent building a thousand patterns for a language nobody uses.

The dependency manifest makes the choice concrete. Two regex crates are optional dependencies, the C one pinned to a specific minor version with its default features switched off, and a pure-Rust one. Each has its own feature flag, so the engine is selected when you build, not when you run.

And the build tooling carries the consequence. The Makefile has a complete parallel set of targets for the alternative engine: a separate syntax test run, a separate known failures baseline, and a separate update command that rewrites that baseline. So the project maintains two sets of expected test failures, which is what it costs to support two regex engines in a library whose main selling point is compatibility.

For anyone packaging this, the practical note is that the default build links a C library. That is a build dependency, a cross-compilation consideration, and a thing to check before shipping to a platform without a prebuilt binary for it.

The compatibility claim is enforced by diffing a summary against a baseline

The compatibility claim is specific and checkable. The readme says nearly complete compatibility with one of the two major editors of its grammar format, and then says it passes nearly all of that editor's own syntax tests, with a link to the tracking issue.

The mechanism behind that claim is in the Makefile rather than the readme, and it is a good one. A target runs the syntax test example over the test data, produces a summary of what passes and what fails, and pipes it through a diff against a stored file of known failures. If the diff is empty, the target prints that there are no new failures. If any previously passing test starts failing, the diff is not empty and the target fails.

So the claim is not a boast with a link; it is a build step that breaks when compatibility regresses, and the baseline is a text file that somebody reads when it changes. There is a companion target that rewrites the baseline, which is the escape hatch a project needs exactly once and then has to be careful with.

Running any of it requires the test data, which is a submodule pointing at the other project's package directory, and the Makefile fetches it recursively before every target that needs it. So a contributor who cloned without the submodule gets nothing rather than a partial run. The readme's own instruction for that case is one command:

bash
git submodule update --init

And installing the library is a different one, with nothing to fetch by hand:

bash
cargo add syntect

Twenty three milliseconds comes from a packed dump inside the binary

Two numbers in the performance list explain each other. Loading and linking every syntax definition from the editor's own package set takes about a hundred and thirty eight milliseconds. Loading the same definitions from an internal pre-made binary dump with lazy regex compilation takes about twenty three.

That six-fold difference is why the feature list contains an item about including a compressed dump of all the default syntax definitions in the library binary, so that users do not have to manage a folder of syntaxes. It is a deliberate trade of binary size for startup time, and the readme presents it as a feature rather than as a cost.

The manifest shows what it takes. Two features exist, one to load a dump and one to create one, and both pull in the same two crates: a compression library and a binary serialisation format. So the packed representation is gated, and the code path that produces it is in the same crate as the code path that reads it.

The same manifest also excludes several things from the published package: the test data directory, the build scripts, the Makefile, and the coverage configuration. So the repository contains a substantial amount of machinery that a consumer of the library never receives, and the only artefact that crosses the boundary is the compiled library with its dump inside.

The published documentation is built with a feature you do not get by default

There is a block in the dependency manifest whose purpose is easy to miss. It tells the documentation host which features to build the documentation with, and it names one feature that is not on by default.

The effect is that the API reference you read online is compiled with more of the crate enabled than a normal install compiles. Anything behind that feature appears in the documentation, is fully documented, and is not present in your build unless you turn it on.

That is a common and mostly benign arrangement. It is also the kind of thing that costs somebody an afternoon: the code in the example does not compile, the signature in the docs has an extra type parameter, and nothing in either place says why.

The version line in the same file carries a reminder comment attached to it, instructing whoever bumps the version to update another field in the manifest. That is a small piece of housekeeping left in the open, which is either a helpful note for the next maintainer or a small piece of release process that lives in one person's memory.

The readme's own code example has its own boundary. It sets up the syntax set and the theme set, looks up a syntax by file extension, creates a highlighter against one of the built-in themes, and then stops partway through the call that produces the highlighted ranges.

The readme says its own screenshots are unrepresentative

The screenshots section opens by explaining why the pictures do not look as good as they could, and it gives two reasons. The colour space correction is not done properly, and the Rust syntax definition uses some labels that the demonstration themes have no highlighting for.

That is the second reason doing the work in the section. The first is a rendering caveat. The second is a statement about grammar coverage: the definition for the language the author writes in uses constructs that the bundled themes do not handle, so a screenshot of Rust code through a default theme undersells the library.

It is the same instinct as the performance section. Where most readmes present the best case, this one names the conditions under which its own artefacts are misleading.

The tooling in the tree points the same way. There is a dev dependency whose entire job is extracting and diffing a crate's public API surface, which is what you install when you intend not to change the interface. There is a benchmarks directory with a criterion-based harness, a coverage configuration, a file listing commits to exclude from blame for the large reformatting passes, and a design document.

None of that is growth. It is the apparatus of a library that intends to be depended on for a long time and intends its surface not to move.

Editorial conclusion

Syntect is the right choice if you are building a text editor in Rust and want Sublime's grammar coverage without vendoring a folder of syntax definitions, and the piece to understand is the regex engine, which is a C library by default and a compile-time choice you make rather than a runtime setting. Read the performance section rather than the feature list, because the numbers are dated to a 2012 laptop and the comparisons are explicitly caveated. And read the feature flags, because the published documentation is built with an extra feature that a plain install does not compile in, so the API you read about is slightly wider than the API you have. Above all, note the author's own position: this is a finished project, not a growing one.

Frequently asked questions

Is the syntect library still actively developed?

The author says the project is mostly complete, that he still maintains it and reviews pull requests, and that it is not under heavy development. The three visible releases are a year or more apart and the last commit to the default branch is dated 2026-04-28.

Which regex engine does syntect use?

A C library called oniguruma is in the default path, and a pure-Rust alternative is available as an optional dependency with its own feature flag. The readme notes the alternative was not faster on the author's benchmarks, and the build tooling maintains a separate expected-failures baseline for each engine.

How does syntect achieve its compatibility with Sublime Text syntax definitions?

By loading the same syntax definition files, and by running that project's own syntax tests: the Makefile target produces a summary of passes and failures and diffs it against a stored baseline of known failures, so a regression fails the build. The test data is a submodule that has to be fetched.

Why does syntect start quickly?

The library binary contains a compressed dump of all the default syntax definitions, loaded with lazy regex compilation. The readme puts that at about twenty three milliseconds against about a hundred and thirty eight for loading and linking the definitions from the package set directly.

Do I need to add a git submodule to use syntect?

Only to run the tests. The readme's getting started section says that if you have cloned the repository you should run the submodule update command to fetch what the tests need. Installing the library from the package registry needs nothing.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. trishume/syntect on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/trishume-syntect.svg)](https://hysenlabs.com/projects/trishume-syntect)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/trishume-syntect.svg)](https://hysenlabs.com/projects/trishume-syntect)

Was this useful?