From 240f15cbf1f7f96e67127809a3a58aab2f9601a9 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Mon, 16 Dec 2024 23:37:53 +1300 Subject: [PATCH] Disable syntect in readme app Signed-off-by: Nico Burns --- apps/readme/Cargo.toml | 2 +- apps/readme/src/markdown.rs | 67 +++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/apps/readme/Cargo.toml b/apps/readme/Cargo.toml index 35cb78ac..a25a4c6e 100644 --- a/apps/readme/Cargo.toml +++ b/apps/readme/Cargo.toml @@ -15,5 +15,5 @@ tokio = { workspace = true } reqwest = { workspace = true } url = { workspace = true } winit = { workspace = true } -comrak = { version = "0.31", default-features = false, features = ["syntect"] } +comrak = { version = "0.31", default-features = false } notify = "7.0.0" diff --git a/apps/readme/src/markdown.rs b/apps/readme/src/markdown.rs index 985e6554..e2dfa5ee 100644 --- a/apps/readme/src/markdown.rs +++ b/apps/readme/src/markdown.rs @@ -1,11 +1,6 @@ //! Render the readme.md using the gpu renderer -use std::collections::HashMap; - -use comrak::{ - adapters::SyntaxHighlighterAdapter, markdown_to_html_with_plugins, - plugins::syntect::SyntectAdapter, ExtensionOptions, Options, Plugins, RenderOptions, -}; +use comrak::{markdown_to_html_with_plugins, ExtensionOptions, Options, Plugins, RenderOptions}; pub(crate) const GITHUB_MD_STYLES: &str = include_str!("../assets/github-markdown.css"); pub(crate) const BLITZ_MD_STYLES: &str = include_str!("../assets/blitz-markdown-overrides.css"); @@ -53,33 +48,39 @@ pub(crate) fn markdown_to_html(contents: String) -> String { ) } -#[allow(unused)] -struct CustomSyntectAdapter(SyntectAdapter); +// #[allow(unused)] +// mod syntax_highlighter { +// use comrak::adapters::SyntaxHighlighterAdapter; +// use comrak::plugins::syntect::SyntectAdapter; +// use std::collections::HashMap; -impl SyntaxHighlighterAdapter for CustomSyntectAdapter { - fn write_highlighted( - &self, - output: &mut dyn std::io::Write, - lang: Option<&str>, - code: &str, - ) -> std::io::Result<()> { - let norm_lang = lang.map(|l| l.split_once(',').map(|(lang, _)| lang).unwrap_or(l)); - self.0.write_highlighted(output, norm_lang, code) - } +// struct CustomSyntectAdapter(SyntectAdapter); - fn write_pre_tag( - &self, - output: &mut dyn std::io::Write, - attributes: HashMap, - ) -> std::io::Result<()> { - self.0.write_pre_tag(output, attributes) - } +// impl SyntaxHighlighterAdapter for CustomSyntectAdapter { +// fn write_highlighted( +// &self, +// output: &mut dyn std::io::Write, +// lang: Option<&str>, +// code: &str, +// ) -> std::io::Result<()> { +// let norm_lang = lang.map(|l| l.split_once(',').map(|(lang, _)| lang).unwrap_or(l)); +// self.0.write_highlighted(output, norm_lang, code) +// } - fn write_code_tag( - &self, - output: &mut dyn std::io::Write, - attributes: HashMap, - ) -> std::io::Result<()> { - self.0.write_code_tag(output, attributes) - } -} +// fn write_pre_tag( +// &self, +// output: &mut dyn std::io::Write, +// attributes: HashMap, +// ) -> std::io::Result<()> { +// self.0.write_pre_tag(output, attributes) +// } + +// fn write_code_tag( +// &self, +// output: &mut dyn std::io::Write, +// attributes: HashMap, +// ) -> std::io::Result<()> { +// self.0.write_code_tag(output, attributes) +// } +// } +// }