Skip to content

Commit

Permalink
Disable syntect in readme app
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns committed Dec 16, 2024
1 parent 106ffa1 commit 240f15c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion apps/readme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
67 changes: 34 additions & 33 deletions apps/readme/src/markdown.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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<String, String>,
) -> 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<String, String>,
) -> std::io::Result<()> {
self.0.write_code_tag(output, attributes)
}
}
// fn write_pre_tag(
// &self,
// output: &mut dyn std::io::Write,
// attributes: HashMap<String, String>,
// ) -> std::io::Result<()> {
// self.0.write_pre_tag(output, attributes)
// }

// fn write_code_tag(
// &self,
// output: &mut dyn std::io::Write,
// attributes: HashMap<String, String>,
// ) -> std::io::Result<()> {
// self.0.write_code_tag(output, attributes)
// }
// }
// }

0 comments on commit 240f15c

Please sign in to comment.