diff options
Diffstat (limited to 'tools/cheddar/src/bin/cheddar.rs')
-rw-r--r-- | tools/cheddar/src/bin/cheddar.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/cheddar/src/bin/cheddar.rs b/tools/cheddar/src/bin/cheddar.rs index 58ef32a1b432..73017a223d7c 100644 --- a/tools/cheddar/src/bin/cheddar.rs +++ b/tools/cheddar/src/bin/cheddar.rs @@ -5,14 +5,13 @@ //! 2. As a long-running HTTP server that handles rendering requests //! (matching the SourceGraph protocol). use clap::{App, Arg}; -use rouille::Response; -use rouille::{router, try_or_400}; +use rouille::{router, try_or_400, Response}; use serde::Deserialize; use serde_json::json; use std::collections::HashMap; use std::io; -use cheddar::{THEMES, format_code, format_markdown}; +use cheddar::{format_code, format_markdown, THEMES}; // Server endpoint for rendering the syntax of source code. This // replaces the 'syntect_server' component of Sourcegraph. @@ -49,7 +48,7 @@ fn markdown_endpoint(request: &rouille::Request) -> rouille::Response { for text in texts.values_mut() { let mut buf: Vec<u8> = Vec::new(); - format_markdown(&mut text.as_bytes(), &mut buf); + format_markdown(&mut text.as_bytes(), &mut buf, true); *text = String::from_utf8_lossy(&buf).to_string(); } @@ -91,6 +90,12 @@ fn main() { .takes_value(false), ) .arg( + Arg::with_name("no-tagfilter") + .help("Disable HTML tag filter") + .long("no-tagfilter") + .takes_value(false), + ) + .arg( Arg::with_name("sourcegraph-server") .help("Run as a Sourcegraph compatible web-server") .long("sourcegraph-server") @@ -123,7 +128,11 @@ fn main() { let mut out_handle = stdout.lock(); if matches.is_present("about-filter") && filename.ends_with(".md") { - format_markdown(&mut in_handle, &mut out_handle); + format_markdown( + &mut in_handle, + &mut out_handle, + !matches.is_present("no-tagfilter"), + ); } else { format_code( &THEMES.themes["InspiredGitHub"], |