Ferriki and syntect
Both Ferriki and syntect are Rust syntax-highlighting libraries with roots in the TextMate/Sublime grammar ecosystem, but their native grammar inputs differ. Their best fit depends on where highlighted output goes, which grammar and theme assets you use, and how your application identifies a language.
Ferriki is aimed at projects that produce HTML. It uses the same native engine from Rust and Node.js, with a Ferriki-maintained selection of TextMate grammars and support dependencies from pinned sources. Syntect is a good choice when your Rust application needs its HTML or terminal-oriented output, or already relies on Sublime Text syntax and theme assets. This page compares the libraries' current interfaces; it does not promise a drop-in API or matching colors.
At a glance
| Concern | Ferriki | syntect |
|---|---|---|
| Main Rust interface | Reusable Highlighter; return themed tokens or rendered HTML | Reusable syntax and theme sets; produce highlighted HTML, styled segments, or terminal output |
| Grammar inputs | Curated TextMate catalog from pinned sources; custom TextMate JSON registrations | Precompiled default syntax set; add .sublime-syntax files or build a syntax set from folders |
| Themes | Shiki-compatible JSON theme subset in generated assets; custom Rust themes register through typed or JSON APIs | Sublime .tmTheme files and built-in themes |
| Regex configuration | Ferroni's pure-Rust Oniguruma-compatible scanner, backed by regex-automata and requiring no C toolchain | regex-onig (C Oniguruma, default) or optional regex-fancy (Rust fancy-regex) feature |
| Output | HTML, class-based HTML, or Rust token records | HTML and styled ranges; a built-in helper formats styled ranges as ANSI escapes |
| Language choice | Caller supplies a language ID to the highlighter | Syntax sets can look up by name, extension, or a grammar's first-line pattern |
| Standard assets | Release-matched catalogs can be loaded from disk, embedded, or fetched with the optional remote feature | Default syntax and theme dumps ship through Cargo features; applications can load additional syntax and theme files |
The Rust highlighter timings for a pinned document set are in the benchmark evidence. They time each library's HTML-producing path with its own default assets and a representative dark theme. Grammars, themes, HTML markup, and language semantics differ, so these timings are descriptive observations—not equal-work parity, a speedup factor, or a prediction for another corpus.
Ferroni also publishes a separate regex-engine comparison. It measures scanner and regex-engine work, not complete highlighter calls, so those figures are not highlighter results and do not predict the HTML timings above.
Grammars and conversion
Syntect documents .sublime-syntax as its native syntax-definition format.
Sublime syntax definitions use named YAML contexts and support variables and
branch/fail matching. TextMate grammars instead use repositories,
begin/end rules, scopes, and optional injections or end backreferences.
The formats overlap in purpose but expose different features and scope
conventions. Neither library's core API is a general-purpose converter between
the two formats. Sublime's syntax format guide
and VS Code's TextMate guide
describe their respective models.
Syntect's default syntax set follows the syntax-definition package set
shipped with Sublime Text, and applications can add .sublime-syntax files
from other folders. bat ships separately reviewed extra definitions and
documents conversions for some .tmLanguage grammars; those additions belong
to bat's bundle, not every syntect default set. There are also separate
conversion paths: bat's asset guide
documents using Sublime Text to create a .sublime-syntax file from a
.tmLanguage grammar, and the ecosystem has adapters such as
syntect_tmlanguage. These are distinct
tools, not an automatic promise that every grammar behaves identically after
conversion. For a grammar you depend on, test its embedded-language rules,
regex features, scope names, and representative source files in the destination
engine.
Ferriki maintains a curated TextMate catalog from pinned upstream sources; it does
not ship Shiki's full grammar selection. The selected sources and resolved commits
are recorded in the grammar source lock.
The language guide lists supported standard IDs and
aliases, with support grammars shown separately. Syntect's default syntax set and
additional .sublime-syntax folders have their own coverage. Compare the specific
grammars your application needs, including injections and embedded languages, against
the supported IDs rather than inferring coverage from a headline count.
Themes and assets
Syntect loads built-in themes and can parse Sublime .tmTheme files. Ferriki's
standard themes are generated from Shiki's JSON theme catalog; custom Rust
themes register through Ferriki's JSON or typed theme APIs. Theme names may
overlap, but their scope selectors and colors are not a shared contract. A
migration should inspect the scopes produced by the selected grammar and verify
the visible result using the theme actually shipped by the application.
Syntect's default-syntaxes and default-themes Cargo features include its
prebuilt defaults. It can also build syntax sets from application-provided
folders. Ferriki's Rust crate reads release-matched asset catalogs from a
directory or borrowed embedded files; the optional remote feature can load
assets from the Ferriki CDN and verify them against the release manifest. In
either library, pin the assets with the library version and plan where your
application will store or distribute custom assets.
Output and language detection
Syntect's direct API provides HTML helpers, styled ranges, and
as_24_bit_terminal_escaped, which formats styled ranges as ANSI escapes (the
function's documentation describes it as a debugging/testing helper). Separate
applications such as syncat and bat build terminal workflows on syntect.
Ferriki's Rust crate returns themed tokens and HTML, including class-based
HTML. Ferriki does not currently provide an ANSI renderer. A terminal
application that depends on syntect's ANSI output does not have a direct
Ferriki replacement today.
Syntect's SyntaxSet offers lookup by file extension, grammar name, and
first-line patterns where a grammar defines one. Ferriki takes a language ID
from its caller. An application can keep its own extension, shebang, or
frontmatter detection and pass the resulting ID to Ferriki. Markdown pipelines
can delegate fences to Ferromark's Ferriki adapter,
which keeps the Markdown wrapper and fallback behavior in the parser.
The HTML APIs also have different output contracts: wrappers, markup, scope styles, and escaping can vary. The benchmark checks that both engines preserve the fixture's source text and emit highlighted markup. It does not compare serialized HTML or claim equivalent highlighting.
Which one fits?
Choose Ferriki for a new Rust or Node.js project that emits HTML, wants one native highlighter across those runtimes, and can use its TextMate-based catalog or maintain a tested conversion for its custom grammar and theme. It can also fit an existing HTML pipeline after checking the application's actual grammars, themes, detection rules, and asset distribution. Rust static-site generators, documentation renderers, and Markdown HTML pipelines are representative use cases.
Keep syntect when your application needs ANSI terminal output, depends on a
particular .sublime-syntax or .tmTheme definition, or needs syntect's
language-detection APIs directly. For an existing syntect HTML application,
first compare the specific grammar, theme, output wrappers, detection rules,
and asset deployment it uses. Terminal tools built around user-supplied
Sublime syntax and theme files are not Ferriki's current target: Ferriki has no
ANSI renderer. The timing results can inform an HTML migration evaluation;
they cannot replace it.
For Rust setup and HTML rendering, see Start with Rust and the Rust API reference.
Sources
- syntect documentation and its maintainer's project status, including HTML helpers, syntax-set builder, and theme set.
- syntect ANSI helper (documented for debugging/testing), plus the
syncatexample. - syntect 5.3.0 feature definitions.
- Ferroni 2.1.0 documents its pure-Rust Oniguruma-compatible scanner; the Ferroni lockfile entry records its
regex-automatadependency. Compare the Onig binding and fancy-regex crate. - Sublime syntax definitions, the Sublime package set, and TextMate grammar integration in VS Code.
- bat asset workflow and
syntect_tmlanguage. - Ferriki Rust API and supported language IDs, aliases, and support grammars.