pretty: embed the theme in-binary

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain 2022-01-18 13:13:45 +05:30
parent 892e84348d
commit f35bad75e5

View File

@ -6,7 +6,9 @@ use syntect::parsing::SyntaxSet;
pub fn get_pretty_body(path: &String, ext: &String) -> String {
let ss = SyntaxSet::load_defaults_newlines();
let theme = ThemeSet::get_theme("themes/ayu_dark.tmTheme").unwrap();
let mut theme_cursor = std::io::Cursor::new(include_bytes!("../../themes/ayu_dark.tmTheme"));
let theme = ThemeSet::load_from_reader(&mut theme_cursor).unwrap();
let content = fs::read_to_string(path).unwrap();
let syntax = ss