Debian Codegraph @

examples/syntect.rs

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 //! This example shows how to use the bundled syntect plugin.
2
3 use comrak::plugins::syntect::SyntectAdapterBuilder;
4 use comrak::{Options, markdown_to_html_with_plugins, options};
5
6 fn main() {
7 run_with(SyntectAdapterBuilder::new().theme("base16-ocean.dark"));
8 run_with(SyntectAdapterBuilder::new().css());
9 }
10
11 fn run_with(builder: SyntectAdapterBuilder) {
12 let adapter = builder.build();
13 let options = Options::default();
14 let mut plugins = options::Plugins::default();
15
16 plugins.render.codefence_syntax_highlighter = Some(&adapter);
17
18 let input = concat!("```Rust\n", "fn main<'a>();\n", "```");
19
20 let formatted = markdown_to_html_with_plugins(input, &options, &plugins);
21
22 println!("{}", formatted);
23 }