Merge pull request #816 from owlseye/highlight-readme

highlight: Make README snippets compile
This commit is contained in:
Max Brunsfeld 2020-11-24 09:51:15 -08:00 committed by GitHub
commit 329592bdc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ extern "C" tree_sitter_javascript();
Define the list of highlight names that you will recognize:
```rust
let highlight_names = [
let highlight_names : Vec<String> = [
"attribute",
"constant",
"function.builtin",
@ -93,14 +93,14 @@ let highlights = highlighter.highlight(
).unwrap();
for event in highlights {
match event? {
match event.unwrap() {
HighlightEvent::Source {start, end} => {
eprintln!("source: {}-{}", start, end);
},
HighlightEvent::HighlightStart(s) {
HighlightEvent::HighlightStart(s) => {
eprintln!("highlight style started: {:?}", s);
},
HighlightEvent::HighlightEnd {
HighlightEvent::HighlightEnd => {
eprintln!("highlight style ended");
},
}