@@ -80,22 +80,31 @@ impl<S: StyleTrait> Renderer<S> {
8080 inline_marks,
8181 line,
8282} =>{
83+ let style =& [ StyleType :: LineNo ] ;
8384if let Some ( lineno) = lineno{
8485S :: fmt (
8586 w,
86- format_args ! ( "{:>1$} " , lineno, lineno_max) ,
87- & [ StyleType :: LineNo , StyleType :: Bold ] ,
87+ format_args ! ( "{:>width$} | " , lineno, width = lineno_max) ,
88+ style ,
8889) ?;
8990} else {
90- write ! ( w, "{:>1$}" , "" , lineno_max) ?;
91+ S :: fmt (
92+ w,
93+ format_args ! ( "{:>width$} | " , "" , width = lineno_max) ,
94+ style,
95+ ) ?;
9196}
92- S :: fmt ( w, " | " , & [ StyleType :: LineNo , StyleType :: Bold ] ) ?;
93- write ! ( w, "{:>1$}" , "" , inline_marks_width - inline_marks. len( ) ) ?;
97+ write ! (
98+ w,
99+ "{:>width$}" ,
100+ "" ,
101+ width = inline_marks_width - inline_marks. len( )
102+ ) ?;
94103for markin inline_marks{
95104self . fmt_display_mark ( w, mark) ?;
96105}
97106self . fmt_source_line ( w, line) ?;
98- write ! ( w, " \n " )
107+ writeln ! ( w)
99108}
100109DisplayLine :: Raw ( l) =>self . fmt_raw_line ( w, l, lineno_max) ,
101110}
@@ -110,15 +119,27 @@ impl<S: StyleTrait> Renderer<S> {
110119DisplaySourceLine :: Content { text} =>write ! ( w, " {}" , text) ,
111120DisplaySourceLine :: Annotation { annotation, range} =>{
112121let ( _, style) =self . get_annotation_type_style ( & annotation. annotation_type ) ;
113- let styles =[ StyleType :: Bold , style] ;
122+ let styles =[ StyleType :: Emphasis , style] ;
114123let indent =if range. start ==0 { 0 } else { range. start +1 } ;
115124write ! ( w, "{:>1$}" , "" , indent) ?;
116125if range. start ==0 {
117- S :: fmt ( w, format_args ! ( "{:_>1$} " , "^" , range. len( ) +1 ) , & styles) ?;
126+ S :: fmt (
127+ w,
128+ format_args ! (
129+ "{:_>width$} {}" ,
130+ "^" ,
131+ annotation. label,
132+ width = range. len( ) +1
133+ ) ,
134+ & styles,
135+ )
118136} else {
119- S :: fmt ( w, format_args ! ( "{:->1$} " , "" , range. len( ) ) , & styles) ?;
137+ S :: fmt (
138+ w,
139+ format_args ! ( "{:->width$} {}" , "" , annotation. label, width = range. len( ) ) ,
140+ & styles,
141+ )
120142}
121- S :: fmt ( w, annotation. label , & styles)
122143}
123144DisplaySourceLine :: Empty =>Ok ( ( ) ) ,
124145}
@@ -133,24 +154,24 @@ impl<S: StyleTrait> Renderer<S> {
133154match line{
134155DisplayRawLine :: Origin { path, pos} =>{
135156write ! ( w, "{:>1$}" , "" , lineno_max) ?;
136- S :: fmt ( w, "-->" , & [ StyleType :: Bold , StyleType :: LineNo ] ) ?;
157+ S :: fmt ( w, "-->" , & [ StyleType :: Emphasis , StyleType :: LineNo ] ) ?;
137158write ! ( w, " {}" , path) ?;
138159if let Some ( line) = pos. 0 {
139160write ! ( w, ":{}" , line) ?;
140161}
141- write ! ( w, " \n " )
162+ writeln ! ( w)
142163}
143164DisplayRawLine :: Annotation { annotation, ..} =>{
144165let ( desc, style) =self . get_annotation_type_style ( & annotation. annotation_type ) ;
145- let s =[ StyleType :: Bold , style] ;
166+ let s =[ StyleType :: Emphasis , style] ;
146167S :: fmt ( w, desc, & s) ?;
147168if let Some ( id) = annotation. id {
148169S :: fmt ( w, format_args ! ( "[{}]" , id) , & s) ?;
149170}
150171S :: fmt (
151172 w,
152173format_args ! ( ": {}\n " , annotation. label) ,
153- & [ StyleType :: Bold ] ,
174+ & [ StyleType :: Emphasis ] ,
154175)
155176}
156177}