use super::util; use ansi_term::Color; use anyhow::Result; use lazy_static::lazy_static; use serde::ser::SerializeMap; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::{json, Value}; use std::collections::HashMap; use std::fmt::Write; use std::sync::atomic::AtomicUsize; use std::time::Instant; use std::{fs, io, path, str, usize}; use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter, HtmlRenderer}; use tree_sitter_loader::Loader; pub const HTML_HEADER: &'static str = " Tree-sitter Highlighting "; pub const HTML_FOOTER: &'static str = " "; lazy_static! { static ref CSS_STYLES_BY_COLOR_ID: Vec = serde_json::from_str(include_str!("../vendor/xterm-colors.json")).unwrap(); } #[derive(Debug, Default)] pub struct Style { pub ansi: ansi_term::Style, pub css: Option, } #[derive(Debug)] pub struct Theme { pub styles: Vec