Skip to content
This repository has been archived by the owner on Feb 12, 2018. It is now read-only.

Commit

Permalink
More up to date readme with screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
trishume committed Jun 6, 2016
1 parent 6922252 commit 9f4eec1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,34 @@

`syntect` is a work-in-progress syntax highlighting library for Rust that uses [Sublime Text syntax definitions](http://www.sublimetext.com/docs/3/syntax.html#include-syntax). It is far from complete but eventually the goal is for it to be used in code analysis tools and text editors.

If you are writing a text editor (or something else needing highlighting) in Rust and this library doesn't fit your needs, I consider that a bug and you should file an issue or email me.

It is currently mostly complete and can parse, interpret and highlight based on Sublime Text syntax and `tmTheme` files.

## Screenshots

There's currently an example program called `syncat` that prints one of the source files using hard-coded themes and syntaxes using 24-bit terminal escape sequences supported by many newer terminals. These screenshots don't look as good as they could for two reasons: first the sRGB colours aren't corrected properly, and second the Rust syntax definition uses some fancy labels that these themes don't have highlighting for.

![Base 16 Ocean Dark](http://i.imgur.com/CwiPOwZ.png)
![Solarized Light](http://i.imgur.com/l3zcO4J.png)

## Goals

- Work with many languages (accomplished through using existing grammar formats)
- Be super fast
- API that is both easy to use, and allows use in fancy text editors with piece tables and incremental re-highlighting and the like
- High quality highlighting, supporting things like heredocs and complex syntaxes (like Rust's).

## Roadmap

- [x] Sketch out representation of a Sublime Text syntax
- [x] Parse `.sublime-syntax` files into the representation.
- [x] Write an interpreter for the `.sublime-syntax` state machine that highlights an incoming iterator of file lines into an iterator of scope-annotated text.
- [x] Parse TextMate/Sublime Text theme files
- [ ] Highlight a scope-annotated iterator into a colour-annotated iterator for display.
- [ ] Add C bindings so it can be used as a C library from other languages.
- [x] Highlight a scope-annotated iterator into a colour-annotated iterator for display.
- [ ] Make the API nicer to use
- [ ] Add good demo programs
- [ ] Document the API
- [ ] Add sRGB colour correction
- [ ] Make it really fast
- [ ] Add C bindings so it can be used as a C library from other languages.
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn as_24_bit_terminal_escaped(v: &[(Style, &str)], bg: bool) -> String {
text)
.unwrap();
}
s.push_str("\x1b[0m");
// s.push_str("\x1b[0m");
s
}

Expand Down

0 comments on commit 9f4eec1

Please sign in to comment.