Skip to content

Commit

Permalink
Remove highlighting and syntect
Browse files Browse the repository at this point in the history
  • Loading branch information
komaeda committed Jun 5, 2019
1 parent 41170ce commit 62696f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2018"
clap = "2.32.0"
indicatif = "0.9.0"
console = "0.6.2"
syntect = "3.0.2"
notify = "4.0.0"
toml = "0.4.10"
serde = {version = "1.0.10", features = ["derive"]}
Expand Down
6 changes: 2 additions & 4 deletions default_out.md → default_out.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Thanks for installing `rustlings`!
Thanks for installing Rustlings!

## Is this your first time?
Is this your first time?

Let's make sure you're up to speed:
- You have Rust installed, preferably via `rustup`
Expand All @@ -9,9 +9,7 @@ Let's make sure you're up to speed:
- You have installed Rust language support for your editor
- You have locally installed the `rustlings` command by running:

```sh
cargo install --path .
```

If you've done all of this (or even most of it), congrats! You're ready
to start working with Rust.
Expand Down
17 changes: 2 additions & 15 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ use notify::DebouncedEvent;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use std::ffi::OsStr;
use std::fs;
use std::io::BufRead;
use std::path::Path;
use std::sync::mpsc::channel;
use std::time::Duration;
use syntect::easy::HighlightFile;
use syntect::highlighting::{Style, ThemeSet};
use syntect::parsing::SyntaxSet;
use syntect::util::as_24_bit_terminal_escaped;

mod exercise;
mod run;
Expand All @@ -35,9 +30,6 @@ fn main() {
)
.get_matches();

let ss = SyntaxSet::load_defaults_newlines();
let ts = ThemeSet::load_defaults();

if None == matches.subcommand_name() {
println!();
println!(r#" welcome to... "#);
Expand Down Expand Up @@ -92,13 +84,8 @@ fn main() {
}

if matches.subcommand_name().is_none() {
let mut highlighter =
HighlightFile::new("default_out.md", &ss, &ts.themes["base16-eighties.dark"]).unwrap();
for maybe_line in highlighter.reader.lines() {
let line = maybe_line.unwrap();
let regions: Vec<(Style, &str)> = highlighter.highlight_lines.highlight(&line, &ss);
println!("{}", as_24_bit_terminal_escaped(&regions[..], true));
}
let text = fs::read_to_string("default_out.txt").unwrap();
println!("{}", text);
}

println!("\x1b[0m");
Expand Down

0 comments on commit 62696f5

Please sign in to comment.