Crate syntect

source ·
Expand description

Welcome to the syntect docs.

Much more info about syntect is available on the Github Page.

May I suggest that you start by reading the Readme.md file in the main repo. Once you’re done with that you can look at the docs for parsing::SyntaxSet and for the easy module.

Almost everything in syntect is divided up into either the parsing module for turning text into text annotated with scopes, and the highlighting module for turning annotated text into styled/colored text.

Some docs have example code but a good place to look is the syncat example as well as the source code for the easy module in easy.rs as that shows how to plug the various parts together for common use cases.

Modules§

  • Methods for dumping serializable structs to a compressed binary format, used to allow fast startup times
  • API wrappers for common use cases like highlighting strings and files without caring about intermediate semantic representation and caching.
  • Everything having to do with turning parsed text into styled text.
  • Rendering highlighted code as HTML+CSS
  • Everything about parsing text into text annotated with scopes.
  • Convenient helper functions for common use cases:

Enums§

  • An error enum for all things that can go wrong within syntect.
  • Common error type used by syntax and theme loading