theme not static

This commit is contained in:
KitsuneCafe 2024-02-02 20:03:56 -05:00
parent 834e48ca57
commit 0cdfa876f9

View file

@ -19,14 +19,14 @@ const CODE_BLOCK_RE: Lazy<Regex> = Lazy::new(|| {
.unwrap()
});
pub struct SyntectParser {
pub struct SyntectParser<'a> {
syntax_set: SyntaxSet,
theme_set: ThemeSet,
theme: &'static str,
theme: &'a str,
}
impl SyntectParser {
pub fn new(theme: &'static str) -> Self {
impl<'a> SyntectParser<'a> {
pub fn new(theme: &'a str) -> Self {
Self {
syntax_set: SyntaxSet::load_defaults_newlines(),
theme_set: ThemeSet::load_defaults(),
@ -35,7 +35,7 @@ impl SyntectParser {
}
}
impl Parse for SyntectParser {
impl<'a> Parse for SyntectParser<'a> {
fn parse(&mut self, _path: &str, src: &[u8], dst: &mut Vec<u8>) -> std::io::Result<()> {
let file = String::from_utf8_lossy(src).to_string();
let result = CODE_BLOCK_RE