Only print headings with level <= 3 bold

Previously, all headings were printed with a bold font.  With this
change, we limit this to headings of level 1 to 3 to make the output
more readable.
This commit is contained in:
Robin Krahl 2020-07-22 23:57:57 +02:00
parent f4b0cba641
commit f709a0d46d
No known key found for this signature in database
GPG Key ID: 8E9B0870524F69D8

View File

@ -43,10 +43,15 @@ impl super::Printer for RichTextRenderer {
}
fn print_heading(&self, level: usize, s: &str) -> io::Result<()> {
write!(io::stdout(), "{}", termion::style::Bold)?;
if level < 4 {
write!(io::stdout(), "{}", termion::style::Bold)?;
}
let heading = format!("<h{level}>{text}</h{level}>", level = level, text = s);
self.print_html(&heading)?;
write!(io::stdout(), "{}", termion::style::Reset)
if level < 4 {
write!(io::stdout(), "{}", termion::style::Reset)?;
}
Ok(())
}
fn println(&self) -> io::Result<()> {