refactor: Move to anstream + anstyle for styling
This commit is contained in:
@@ -521,11 +521,11 @@ fn show_md_content_with_pager(content: &str, color: ColorConfig) {
|
||||
};
|
||||
|
||||
// Try to prettify the raw markdown text. The result can be used by the pager or on stdout.
|
||||
let pretty_data = {
|
||||
let mut pretty_data = {
|
||||
let mdstream = markdown::MdStream::parse_str(content);
|
||||
let bufwtr = markdown::create_stdout_bufwtr();
|
||||
let mut mdbuf = bufwtr.buffer();
|
||||
if mdstream.write_termcolor_buf(&mut mdbuf).is_ok() { Some((bufwtr, mdbuf)) } else { None }
|
||||
let mut mdbuf = Vec::new();
|
||||
if mdstream.write_anstream_buf(&mut mdbuf).is_ok() { Some((bufwtr, mdbuf)) } else { None }
|
||||
};
|
||||
|
||||
// Try to print via the pager, pretty output if possible.
|
||||
@@ -546,8 +546,8 @@ fn show_md_content_with_pager(content: &str, color: ColorConfig) {
|
||||
}
|
||||
|
||||
// The pager failed. Try to print pretty output to stdout.
|
||||
if let Some((bufwtr, mdbuf)) = &pretty_data
|
||||
&& bufwtr.print(mdbuf).is_ok()
|
||||
if let Some((bufwtr, mdbuf)) = &mut pretty_data
|
||||
&& bufwtr.write_all(&mdbuf).is_ok()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user