diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b7c59d2c0..7e0d66437 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -17,4 +17,5 @@ camino = "1.0" chrono = { version = "0.4.23", default_features = false, features = ["std"] } fn-error-context = "0.2.0" tempfile = "3.3" +mandown = "0.1" xshell = { version = "0.2" } diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index 00bb0681b..cf0126431 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -104,11 +104,12 @@ fn manpages(sh: &Shell) -> Result<()> { .file_stem() .and_then(|name| name.to_str()) .ok_or_else(|| anyhow!("Expected filename in {srcpath:?}"))?; - cmd!( - sh, - "pandoc -s --from=markdown --to=man --output=target/man/{base_filename}.5 {srcpath}" - ) - .run()?; + let src = + std::fs::read_to_string(&srcpath).with_context(|| format!("Reading {srcpath:?}"))?; + let section = 5; + let buf = mandown::convert(&src, base_filename, section); + let target = format!("target/man/{base_filename}.{section}"); + std::fs::write(&target, buf).with_context(|| format!("Writing {target}"))?; } Ok(()) }