Last active
October 6, 2019 18:52
-
-
Save marcusbuffett/64f85576f0eb37199d1da3e47d3245e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn convert_to_html(input: &str) -> String { | |
let cmd = Command::new("pandoc") | |
.args(&["--from=markdown", "--to=html"]) | |
.stdin(Stdio::piped()) | |
.stdout(Stdio::piped()) | |
.spawn() | |
.expect("pandoc failed to start"); | |
{ | |
let mut pandoc_stdin = cmd.stdin.unwrap(); | |
pandoc_stdin.write_all(& input.as_bytes()); | |
} | |
// write!(pandoc_stdin, "# header").unwrap(); | |
let mut pd_out_bytes = Vec::new(); | |
// let mut stdout_out: [u8] = []; | |
println!("Gets here"); | |
cmd.stdout.unwrap().read_to_end(&mut pd_out_bytes); | |
println!("Does not get here"); | |
return String::from_utf8(pd_out_bytes).unwrap(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn convert_to_html(input: &str) -> String { | |
let cmd = Command::new("pandoc") | |
.args(&["--from=markdown", "--to=html"]) | |
.stdin(Stdio::piped()) | |
.stdout(Stdio::piped()) | |
.spawn() | |
.expect("pandoc failed to start"); | |
let mut pandoc_stdin = cmd.stdin.unwrap(); | |
write!(pandoc_stdin, "# header").unwrap(); | |
let mut pd_out_bytes = Vec::new(); | |
// let mut stdout_out: [u8] = []; | |
println!("Gets here"); | |
cmd.stdout.unwrap().read_to_end(&mut pd_out_bytes); | |
println!("Does not get here"); | |
return String::from_utf8(pd_out_bytes).unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment