From e675344b23db439a8d7bd8c3a0c0787af4d26530 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 1 Oct 2023 21:29:11 -0500 Subject: [PATCH] Improve code blocks --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/generator/code.rs | 4 ++-- src/main.rs | 8 ++++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64db968..e29fb83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "md-docs" -version = "0.1.0" +version = "0.1.2" dependencies = [ "clap", "markdown", diff --git a/Cargo.toml b/Cargo.toml index 424bc6a..f0cbe8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "md-docs" -version = "0.1.0" +version = "0.1.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/generator/code.rs b/src/generator/code.rs index d915ca0..7d53632 100644 --- a/src/generator/code.rs +++ b/src/generator/code.rs @@ -15,9 +15,9 @@ impl Printable for Code { return generate_nav_html(&self.value); } - format!("
{}
", lang, code) + format!("
{}
", lang, code) } else { - format!("
{}
", code) + format!("
{}
", code) } } diff --git a/src/main.rs b/src/main.rs index 32fc540..84fa91f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,14 @@ mod sidebar; mod utils; fn main() { + // get args + let args: Vec = std::env::args().collect(); + // if first arg is --version, print version and exit + if args.len() > 1 && args[1] == "--version" { + println!("md-docs {}", env!("CARGO_PKG_VERSION")); + return; + } + let config_file = Path::new(CONFIG_NAME); if !config_file.is_file() { eprintln!("A {} file was not found. Aborting.", CONFIG_NAME);