syntect
library for high quality syntax highlighting and code intelligence using Sublime Text's grammars
5.3.0
24M downloads/mo
#1911 most downloaded on crates.io
trishume/syntect
What this package is like to depend on
Last release 11 months ago
27 Sep 2025
Release timing varies
gaps range from 3 weeks to 1.6 years
Most releases are documented
notes for 30 of 46 stable releases
3 versions withdrawn
withdrawn after publishing
10 years old
49 releases · first in 2016
1 release in the last 12 months
see the full history below
Release timeline
49 releases · Jun 2016 to Sep 2025Releases
latest 49-
5.3.027 Sep 2025Release notes
Open source →Improvements
- Add
HighlightLines::from_state()constructor [#569]
Fixes
- Ignore UTF-8 BOM on syntax detection [#530]
- Escape CSS class names [#539]
- Avoid an infinite loop when a syntax definition continually pushes contexts without consuming any input [#597]
- Return an error when a syntax definition contains an unescaped trailing backslash instead of panicking at runtime [#548]
Dependencies
- Replace
bitflagswith a manual implementation [#590] - Update
public-apito work with new lockfile versions [#591] - Update
thiserrorto v2 [#594] - Update
fancy-regexto0.16.2[#596] - Bump
rust_onigversion to avoid build failures on newer GCC versions [#584]
Docs
- Add various projects to the README showcase:
- Deprecate
syntect::parsing::SCOPE_REPOfor removal [#580]
Other
- Format with
rustfmt[#528] - Bump nightly toolchain version to fix a test build failure [#542]
- Remove unused import in yaml load test [#531]
- Use
BufWriterto improve unoptimized serialization perf [#554] - Commit
Cargo.lockto avoid flaky CI issues [#567] - Switch from
expect-testtoinsta[#568] then later topublic-api'ssnapshot-testingsupport [#595] - Speed up unittest runtime [#577] [#598]
- Fix new clippy lints [#585]
- Use
cargo-hackto check many different features in CI [#593]
Release notes
Open source →Improvements
- Add
HighlightLines::from_state()constructor [#569]
Fixes
- Ignore UTF-8 BOM on syntax detection [#530]
- Escape CSS class names [#539]
- Avoid an infinite loop when a syntax definition continually pushes contexts without consuming any input [#597]
- Return an error when a syntax definition contains an unescaped trailing backslash instead of panicking at runtime [#548]
Dependencies
- Replace
bitflagswith a manual implementation [#590] - Update
public-apito work with new lockfile versions [#591] - Update
thiserrorto v2 [#594] - Update
fancy-regexto0.16.2[#596] - Bump
rust_onigversion to avoid build failures on newer GCC versions [#584]
- Add
-
5.2.007 Feb 2024Release notes
Open source →Improvements
- Eliminate syntect library's dependency on serde's "derive" feature. Increases build parallelism.
- Add parsing of gutterSettings.
Dependencies
- Update
regex-syntaxto 0.8.
Release notes
Open source →Improvements
- Eliminate syntect library's dependency on serde's "derive" feature. Increases build parallelism.
- Add parsing of gutterSettings.
Dependencies
- Update
regex-syntaxto 0.8.
-
5.1.031 Jul 2023Release notes
Open source →Improvements
- Fix how
syntect::util::split_at()handles multi-byte characters - Allow case insensitive search for .tmtheme paths
- impl
PartialEqforTheme
Dependencies
- Upgrade
fancy-regexto 0.11 - Upgrade
regex-syntaxto 0.7 - Replace
lazy_staticwithonce_cell
Other
- Change MSRV policy to "last three stable versions"
- Make
Debugimpl ofsyntect::highlighting::Colorless verbose
Release notes
Open source →Improvements
- Fix how
syntect::util::split_at()handles multi-byte characters - Allow case insensitive search for .tmtheme paths
- impl
PartialEqforTheme
Dependencies
- Upgrade
fancy-regexto 0.11 - Upgrade
regex-syntaxto 0.7 - Replace
lazy_staticwithonce_cell
Other
- Change MSRV policy to "last three stable versions"
- Make
Debugimpl ofsyntect::highlighting::Colorless verbose
- Fix how
-
5.0.004 May 2022Release notes
Open source →Breaking changes
- Lazy-load syntaxes to significantly improve startup time. This changes the binary format of syntax dump files.
- Remove
ContextId::new()from public API to support lazy-loading of syntaxes - Rename
HighlightLines::highlight()toHighlightLines::highlight_line()to make it clear that the function takes one line at a time - Make
plistdependency (used for loading themes) optional via newplist-loadfeature - Remove obsolete
dump-load-rsanddump-create-rsfeatures that has been identical todump-loadanddump-createfor two years - Remove deprecated items
ThemeSettings::highlight_foreground,ThemeSettings::selection_background,ClassedHTMLGenerator::new,ClassedHTMLGenerator::parse_html_for_line,html::css_for_theme,html::tokens_to_classed_htmlandhtml::tokens_to_classed_spans - Mark all error enums as
#[non_exhaustive] - These functions have been changed to return a
Resultto allow propagation of errors:html::ClassedHTMLGenerator::parse_html_for_line_which_includes_newlinehtml::append_highlighted_html_for_styled_linehtml::css_for_theme_with_class_stylehtml::highlighted_html_for_stringhtml::line_tokens_to_classed_spanshtml::styled_line_to_highlighted_htmlparsing::ParseState::parse_lineparsing::ScopeStack::applyparsing::ScopeStack::apply_with_hookparsing::syntax_definition::Context::match_atparsing::syntax_definition::ContextReference::idparsing::syntax_definition::ContextReference::resolve
Other changes
- Fall back to
Plain Textif a referenced syntax is missing - Add support for
hidden_file_extensionskey in syntaxes. - Implement
ErrorandDisplayfor all error enums by usingthiserror - Replace
lazycellwithonce_cellto fix crash on lazy initialization - Add
ScopeRangeIterator - Add CI check for Minimum Supported Rust Version. This is currently Rust 1.53.
- Make looking up a syntax by extension use case-insensitive comparison
- Make
from_dump_file()~15% faster - Blend alpha value on converting colors to ANSI color sequences
- Fix sample code in documentation to avoid double newlines
- Fix lots of build warnings and lints
- Add Criterion benchmarks for a whole syntect pipeline and for
from_dump_file()
-
4.7.102 Jan 2022 withdrawn -
4.7.026 Dec 2021 withdrawnRelease notes
Open source →See the release notes for v4.7.0, this release removes a new Cargo feature which constituted a semver violation:
- Remove 'plist-load' feature again due to semver violation. #403
-
4.6.001 Aug 2021Release notes
Open source →- Add
html::line_tokens_to_classed_spansto also take a mutable ScopeStack, deprecatetokens_to_classed_spans, to avoid panics and incorrect highlighting. - Derive Hash for Color and Style
- Add
find_unlinked_contextstoSyntaxSet - Add
syntaxesmethod toSyntaxSetBuilder - Bump
fancy-regexto v0.7 andyaml-rustto v0.4.5
- Add
-
4.5.009 Dec 2020Release notes
Open source →- Added a new function for producing classed HTML which handles newlines correctly and deprecated old one. #307
-
4.4.020 Aug 2020 -
4.3.002 Aug 2020 -
4.2.023 May 2020Release notes
Open source →- Updates to new versions of
onigandplist. The newonigversion doesn't requirebindgenthus making compilation easier. #293
- Updates to new versions of
-
4.1.121 Apr 2020 -
4.1.031 Mar 2020Release notes
Open source →Thanks @sharkdp for the bug fixes! Bumping second part of semver since
Sendis adding functionality (back). -
4.0.029 Mar 2020Release notes
Open source →Headline feature: pure-Rust
fancy-regexengine optionUsers can now opt in to a pure-Rust regex engine using Cargo features, making compilation easier in general. People experiencing difficulty compiling for Windows and Wasm should try switching to
fancy-regex. Note this currently approximately halves highlighting speed.See the Readme and #270 for details. Thanks to @robinst for implementing this!
Other changes
- Ability to generate CSS for a theme for use with classed HTML generation (won't always be correct) #274
- Don't generate empty spans in classed HTML #276
- Miscellaneous dependency bumps and cleanup
Breaking changes and upgrading
Upgrading should cause no errors for nearly all users. Users using more unusual APIs may have a small amount of tweaking to do.
- If you use
default-features = falseyou may need to update your features to choose a regex engine - A bunch of technically public APIs that I don't know if anyone uses changed due to the regex engine refactor, common uses shouldn't break
-
3.3.022 Sep 2019Release notes
Open source →Bug fixes and new utilities
- Fixes multiple bugs
- Add RangedHighlightIterator
- Add
as_latex_escapedutil
-
3.2.110 Aug 2019 -
3.2.009 Mar 2019 -
3.1.024 Feb 2019 -
3.0.211 Nov 2018 -
3.0.116 Oct 2018 -
3.0.009 Oct 2018Release notes
Open source →Breaking changes and major new features
This is a major release with multiple breaking API changes, although upgrading shouldn't be too difficult. It fixes bugs and comes with some nice new features.
Breaking changes and upgrading
- The
SyntaxSetAPI has been revamped to use a builder and an arena of contexts. See example usage. - Many functions now need to be passed the
SyntaxSetthat goes with the rest of their arguments because of this new arena. - Filename added to
LoadingError::ParseSyntax - Many functions in the
htmlmodule now take thenewlinesversion of syntaxes.- These methods have also been renamed, partially so that code that needs updating doesn't break without a compile error.
- The HTML they output also treats newlines slightly differently and I think more correctly but uglier when you look at the HTML.
Breaking rename upgrade guide
SyntaxSet::add_syntax -> SyntaxSetBuilder::addSyntaxSet::load_syntaxes -> SyntaxSetBuilder::add_from_folderSyntaxSet::load_plain_text_syntax -> SyntaxSetBuilder::add_plain_text_syntaxhtml::highlighted_snippet_for_string -> html::highlighted_html_for_string: also change tonewlinesSyntaxSethtml::highlighted_snippet_for_file -> html::highlighted_html_for_file: also change tonewlinesSyntaxSethtml::styles_to_coloured_html -> html::styled_line_to_highlighted_html: also change tonewlinesSyntaxSethtml::start_coloured_html_snippet -> html::start_highlighted_html_snippet: return type also changed
Major changes and new features
- Use arena for contexts (#182 #186 #187 #190 #195): This makes the code cleaner, enables use of syntaxes from multiple threads, and prevents accidental misuse.
- This involves a new
SyntaxSetBuilderAPI for constructing newSyntaxSets - See the revamped parsyncat example.
- This involves a new
- Encourage use of newlines (#197 #207 #196): The
nonewlinesmode is often buggy so we made it easier to use thenewlinesmode.- Added a
LinesWithEndingsutility for iterating over the lines of a string with\ncharacters. - Reengineer the
htmlmodule to usenewlinessyntaxes.
- Added a
- Add helpers for modifying highlighted lines (#198): For use cases like highlighting a piece of text in a blog code snippet or debugger. This allows you to reach into the highlighted spans and add styles.
- Check out
split_atandmodify_rangein theutilmodule.
- Check out
- New
ThemeSet::add_from_folderfunction (#200): For modifying existing theme sets.
Bug Fixes
- Improve nonewlines regex rewriting: #212 #211
- Reengineer theme application to match Sublime: #209
- Also mark contexts referenced by name as "no prototype" (same as ST): #180
- keep with_prototype when switching contexts with
set: #177 #166 - Fix unused import warning: #174
- Ignore trailing dots in selectors: #173
- Fix
embedto not include prototypes: #172 #160
Upgraded dependencies
- plist:
0.2 -> 0.3 - regex:
0.2 -> 1.0 - onig:
3.2.1 -> 4.1
- The
-
2.1.031 May 2018Release notes
Open source →Regex checking and plain file names
- Check regexes compile upon loading from YAML (There's technically a small breaking change here if you match on the previously unused regex error, but I don't think anyone does)
- Can detect the correct syntax on full file names like
CMakeLists.txt - Make
nonewlinesmode marginally less buggy (still prefer usingnewlinesmode) - Better error types
- Better examples and tests
-
2.0.128 Apr 2018Release notes
Open source →More robust parsing
- Parsing now abandons a regex after reaching a recursion depth limit instead of taking forever
- Loop detection better matches Sublime Text
- Parsing is faster!
- Dependency upgrades
- Other minor tweaks
Thanks to @robinst for the headline features of this release!
-
2.0.002 Jan 2018Release notes
Open source →Breaking Changes and New Stuff
Breaking changes
- The
static-onigfeature was removed, static linking is now the default - Font styles and color constants now use associated consts because of bitflags upgrade
SyntaxDefinition::load_from_strnow has an extra parameter
Other notable changes
- Support for new
embedsyntax, see #124 - Updates to many dependencies
- Updated dumps
- More compact HTML output
- The
-
1.8.211 Nov 2017 withdrawn -
1.8.111 Nov 2017Nothing published for this version
-
1.8.013 Oct 2017Release notes
Open source →Update bitflags & packages
This release changes how the constants for
FontStyleandColor, relying on the new associated consts feature inRust 1.20. The old constants are still available but are deprecated and will be removed inv2.0.Packages were also updated to newer versions.
-
1.7.314 Sep 2017Release notes
Open source →Enable comparison of parse states
Fixes comparisons of parse states so they are fast and don't recurse infinitely. Thanks @raphlinus
-
1.7.205 Sep 2017Release notes
Open source →Bug fixes and package updates
- Fixes #101, which caused some syntaxes like PHP to behave incorrectly.
- Updates Packages with new syntax versions
- Adds new handy flags to the
syncatexample
-
1.7.109 Jul 2017Nothing published for this version
-
1.7.030 Jun 2017 -
1.6.021 Jun 2017 -
1.5.031 May 2017Release notes
Open source →Highlighting stacks
Small release, adds a convenience method for highlighting an entire stack, and derives some more things on
Scope. -
1.4.025 May 2017Release notes
Open source →Serde and optional parsing
This release switches the dump format from
rustc-serializetoSerde, anyone using custom dumps will have to update them.It also makes the parsing part of the library optional behind a feature flag, anyone not using the default feature flags probably will want to add the
parsingflag. -
1.3.005 Apr 2017Release notes
Open source →Bug fixes, tests, updates and feature flags
- Syntax tests: there is a new
syntestexample for running Sublime Text syntax tests - Bug fixes: there's a ton of bugs fixed in this release, mostly found via the syntax tests. These mostly affected certain syntaxes which pushed/set multiple contexts at once.
- Updated packages: The Sublime packages have been updated to the latest version
- Feature flags: there's now Cargo feature flags for disabling some parts of syntect if you don't want unnecessary binary and dependency bloat.
- Syntax tests: there is a new
-
1.2.009 Mar 2017Nothing published for this version
-
1.1.122 Feb 2017Nothing published for this version
-
1.1.006 Feb 2017Nothing published for this version
-
1.0.417 Jan 2017Nothing published for this version
-
1.0.312 Jan 2017Nothing published for this version
-
1.0.222 Dec 2016Nothing published for this version
-
1.0.114 Oct 2016Nothing published for this version
-
1.0.017 Jul 2016Nothing published for this version
-
0.7.002 Jul 2016Nothing published for this version
-
0.6.026 Jun 2016Nothing published for this version
-
0.5.025 Jun 2016Nothing published for this version
-
0.4.022 Jun 2016Nothing published for this version
-
0.3.321 Jun 2016Nothing published for this version
-
0.3.220 Jun 2016Nothing published for this version