@@ -27,26 +27,7 @@ public MyHeading(HeadingBlock headingBlock, MarkdownConfig config)
2727        _paragraph  =  new  Paragraph ( ) ; 
2828        _config  =  config ; 
2929
30-         var  level  =  headingBlock . Level ; 
31-         _paragraph . FontSize  =  level  switch 
32-         { 
33-             1  =>  _config . Themes . H1FontSize , 
34-             2  =>  _config . Themes . H2FontSize , 
35-             3  =>  _config . Themes . H3FontSize , 
36-             4  =>  _config . Themes . H4FontSize , 
37-             5  =>  _config . Themes . H5FontSize , 
38-             _ =>  _config . Themes . H6FontSize , 
39-         } ; 
40-         _paragraph . Foreground  =  _config . Themes . HeadingForeground ; 
41-         _paragraph . FontWeight  =  level  switch 
42-         { 
43-             1  =>  _config . Themes . H1FontWeight , 
44-             2  =>  _config . Themes . H2FontWeight , 
45-             3  =>  _config . Themes . H3FontWeight , 
46-             4  =>  _config . Themes . H4FontWeight , 
47-             5  =>  _config . Themes . H5FontWeight , 
48-             _ =>  _config . Themes . H6FontWeight , 
49-         } ; 
30+         SetHProperties ( headingBlock . Level ) ; 
5031    } 
5132
5233    public  MyHeading ( HtmlNode  htmlNode ,  MarkdownConfig  config ) 
@@ -65,7 +46,11 @@ public MyHeading(HtmlNode htmlNode, MarkdownConfig config)
6546            _ =>  TextAlignment . Left , 
6647        } ; 
6748
68-         var  level  =  int . Parse ( htmlNode . Name . Substring ( 1 ) ) ; 
49+         SetHProperties ( int . Parse ( htmlNode . Name . Substring ( 1 ) ) ) ; 
50+     } 
51+ 
52+     private  void  SetHProperties ( int  level ) 
53+     { 
6954        _paragraph . FontSize  =  level  switch 
7055        { 
7156            1  =>  _config . Themes . H1FontSize , 
@@ -85,6 +70,15 @@ public MyHeading(HtmlNode htmlNode, MarkdownConfig config)
8570            5  =>  _config . Themes . H5FontWeight , 
8671            _ =>  _config . Themes . H6FontWeight , 
8772        } ; 
73+         _paragraph . Margin  =  level  switch 
74+         { 
75+             1  =>  _config . Themes . H1Margin , 
76+             2  =>  _config . Themes . H2Margin , 
77+             3  =>  _config . Themes . H3Margin , 
78+             4  =>  _config . Themes . H4Margin , 
79+             5  =>  _config . Themes . H5Margin , 
80+             _ =>  _config . Themes . H6Margin , 
81+         } ; 
8882    } 
8983
9084    public  void  AddChild ( IAddChild  child ) 
0 commit comments