Skip to content

Commit e63ab07

Browse files
committed
Format whole background for code blocks
1 parent c0cc243 commit e63ab07

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/message/html.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ impl StyleTreeNode {
366366
},
367367
StyleTreeNode::Code(child, _) => {
368368
let style = style.bg(Color::Indexed(236));
369+
let old = printer.set_base_style(style);
369370
child.print(printer, style);
371+
printer.set_base_style(old);
370372
},
371373
StyleTreeNode::Header(child, level) => {
372374
let style = style.add_modifier(StyleModifier::BOLD);

src/message/printer.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ impl<'a> TextPrinter<'a> {
9292
self.width
9393
}
9494

95+
/// Sets the base style and returns the old style
96+
pub fn set_base_style(&mut self, new: Style) -> Style {
97+
std::mem::replace(&mut self.base_style, new)
98+
}
99+
95100
/// Create a new printer with a smaller width.
96101
pub fn sub(&self, indent: usize) -> Self {
97102
TextPrinter {

0 commit comments

Comments
 (0)