Updates for md2pdf #1

Merged
tforgione merged 6 commits from williamdes/md2pdf:master into master 2022-10-02 15:27:28 +02:00
1 changed files with 21 additions and 2 deletions
Showing only changes of commit cb90c6a4ad - Show all commits

View File

@ -58,8 +58,27 @@ fn main() {
unwrap!(output.write(tex.as_bytes()), "couldn't write output file");
},
Some("pdf") => {
let data = unwrap!(markdown_to_pdf(content), "error while compiling latex, this is most likely a bug");
unwrap!(output.write(&data), "couldn't write output file");
match markdown_to_pdf(content) {
Ok(data) => {
match output.write(&data) {
Ok(_) => {
exit(0);
},
Err(error) => {
eprintln!(
"error while writing file: {}", error
);
exit(1);
},
}
},
Err(error) => {
eprintln!(
"error while compiling latex: {}", error.description()
);
exit(1);
}
}
},
Some(ext) => {
eprintln!("unknown file format ({}) for output: {}", ext, output_path.display());