feat(tools/cheddar): allow disabling tagfilter extension

Makes it possible to do things like embedding YouTube videos in blog
posts rendered through Cheddar.

Change-Id: I6aed943c7bec0167b9f009d36dd067c52c6d3083
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9275
Tested-by: BuildkiteCI
Reviewed-by: Mark Shevchenko <markshevchenko@gmail.com>
This commit is contained in:
Vincent Ambo 2023-09-08 15:37:37 +03:00 committed by tazjin
parent 94ebb30b1f
commit 87d63e4a1b
3 changed files with 24 additions and 7 deletions

View file

@ -48,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();
}
@ -89,6 +89,12 @@ fn main() {
.long("about-filter")
.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")
@ -122,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"],