From 20a099c16f80a694a01ad131fe272762160e7879 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 2 Jan 2021 06:47:55 +0900 Subject: [PATCH] Replace Syntect's deprecated APIs with new APIs --- plume-common/src/utils.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plume-common/src/utils.rs b/plume-common/src/utils.rs index d9949eaa..ecbea8f1 100644 --- a/plume-common/src/utils.rs +++ b/plume-common/src/utils.rs @@ -7,7 +7,7 @@ use rocket::{ response::{Flash, Redirect}, }; use std::collections::HashSet; -use syntect::html::ClassedHTMLGenerator; +use syntect::html::{ClassedHTMLGenerator, ClassStyle}; use syntect::parsing::SyntaxSet; /// Generates an hexadecimal representation of 32 bytes of random data @@ -92,9 +92,9 @@ fn highlight_code<'a>( .find_syntax_by_name(&lang) .unwrap_or_else(|| syntax_set.find_syntax_plain_text()) }); - let mut html = ClassedHTMLGenerator::new(&syntax, &syntax_set); + let mut html = ClassedHTMLGenerator::new_with_class_style(&syntax, &syntax_set, ClassStyle::Spaced); for line in ctx.content { - html.parse_html_for_line(&line); + html.parse_html_for_line_which_includes_newline(&line); } let q = html.finalize(); result.push(Event::Html(q.into()));