Files
markbase/markbase-core/src/cli/tools/render.rs
T
Warren d94cb2df4c Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs
- Add missing KexProposal import in kex_complete.rs
- Auto-fix clippy warnings across all crates
- All 153 tests pass
2026-06-19 05:21:38 +08:00

27 lines
636 B
Rust

use clap::Subcommand;
#[derive(Subcommand)]
pub enum RenderCommand {
File {
#[arg(short, long)]
file: String,
#[arg(short, long)]
output: Option<String>,
},
}
pub fn handle_render_command(cmd: RenderCommand) -> anyhow::Result<()> {
match cmd {
RenderCommand::File { file, output } => {
let md = std::fs::read_to_string(&file)?;
let html = crate::render::md_to_html(&md);
if let Some(path) = &output {
std::fs::write(path, html)?;
} else {
println!("{html}");
}
}
}
Ok(())
}