Crate syntect [] [src]

Welcome to the syntect docs. These are still a work in progress but a lot of the important things have been documented already.

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/coloured 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

dumps

Methods for dumping serializable structs to a compressed binary format These are used to load and store the dumps used for fast startup times.

easy

API wrappers for common use cases like highlighting strings and files without caring about intermediate semantic representation and caching.

highlighting

Everything having to do with turning parsed text into styled text. You might want to check out Theme for its handy text-editor related settings like selection colour, ThemeSet for loading themes, as well as things starting with Highlight for how to highlight text.

html

Rendering highlighted code as HTML+CSS

parsing

Everything about parsing text into text annotated with scopes. The most important struct here is SyntaxSet, check out the docs for that.

util

Convenient utility methods, mostly for printing syntect data structures prettily to the terminal.

Enums

LoadingError

Common error type used by syntax and theme loading