@@ -54,6 +54,7 @@ pub struct HeadingLevelStyles {
5454#[ derive( Clone ) ]
5555pub struct MarkdownStyle {
5656 pub base_text_style : TextStyle ,
57+ pub container_style : StyleRefinement ,
5758 pub code_block : StyleRefinement ,
5859 pub code_block_overflow_x_scroll : bool ,
5960 pub inline_code : TextStyleRefinement ,
@@ -74,6 +75,7 @@ impl Default for MarkdownStyle {
7475 fn default ( ) -> Self {
7576 Self {
7677 base_text_style : Default :: default ( ) ,
78+ container_style : Default :: default ( ) ,
7779 code_block : Default :: default ( ) ,
7880 code_block_overflow_x_scroll : false ,
7981 inline_code : Default :: default ( ) ,
@@ -748,6 +750,12 @@ impl MarkdownElement {
748750 }
749751}
750752
753+ impl Styled for MarkdownElement {
754+ fn style ( & mut self ) -> & mut StyleRefinement {
755+ & mut self . style . container_style
756+ }
757+ }
758+
751759impl Element for MarkdownElement {
752760 type RequestLayoutState = RenderedMarkdown ;
753761 type PrepaintState = Hitbox ;
@@ -768,6 +776,7 @@ impl Element for MarkdownElement {
768776 cx : & mut App ,
769777 ) -> ( gpui:: LayoutId , Self :: RequestLayoutState ) {
770778 let mut builder = MarkdownElementBuilder :: new (
779+ & self . style . container_style ,
771780 self . style . base_text_style . clone ( ) ,
772781 self . style . syntax . clone ( ) ,
773782 ) ;
@@ -1441,9 +1450,17 @@ struct ListStackEntry {
14411450}
14421451
14431452impl MarkdownElementBuilder {
1444- fn new ( base_text_style : TextStyle , syntax_theme : Arc < SyntaxTheme > ) -> Self {
1453+ fn new (
1454+ container_style : & StyleRefinement ,
1455+ base_text_style : TextStyle ,
1456+ syntax_theme : Arc < SyntaxTheme > ,
1457+ ) -> Self {
14451458 Self {
1446- div_stack : vec ! [ div( ) . debug_selector( || "inner" . into( ) ) . into( ) ] ,
1459+ div_stack : vec ! [ {
1460+ let mut base_div = div( ) ;
1461+ base_div. style( ) . refine( container_style) ;
1462+ base_div. debug_selector( || "inner" . into( ) ) . into( )
1463+ } ] ,
14471464 rendered_lines : Vec :: new ( ) ,
14481465 pending_line : PendingLine :: default ( ) ,
14491466 rendered_links : Vec :: new ( ) ,
0 commit comments