FIxing the README in highlight (#501)
* Correct README.md in /highlight correct the lifetime in highlighter.highlight and correct the cases in match so that the demo in README could work. * Update README.md another small fix * Update highlight/README.md Co-Authored-By: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
parent
2758103646
commit
acc5f092c8
1 changed files with 6 additions and 6 deletions
|
|
@ -80,22 +80,22 @@ Highlight some code:
|
|||
use tree_sitter_highlight::HighlightEvent;
|
||||
|
||||
let highlights = highlighter.highlight(
|
||||
javascript_config,
|
||||
&javascript_config,
|
||||
b"const x = new Y();",
|
||||
None,
|
||||
&|_| None
|
||||
|_| None
|
||||
).unwrap();
|
||||
|
||||
for event in highlights {
|
||||
match event? {
|
||||
HighlightEvent::Source(s) {
|
||||
eprintln!("source: {:?}", s);
|
||||
HighlightEvent::Source {start, end} => {
|
||||
eprintln!("source: {}-{}", start, end);
|
||||
},
|
||||
HighlightEvent::HighlightStart(s) {
|
||||
eprintln!("highlight style started: {:?}", s);
|
||||
},
|
||||
HighlightEvent::HighlightEnd(s) {
|
||||
eprintln!("highlight style ended: {:?}", s);
|
||||
HighlightEvent::HighlightEnd {
|
||||
eprintln!("highlight style ended");
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue