@@ -245,6 +245,13 @@ fn process_old_new(
245245 .diff-content {{
246246 overflow-x: auto;
247247 }}
248+ .diff-content > .filename-line:first-child {{
249+ display: none;
250+ }}
251+ .filename-block {{
252+ background-color: #89a1cd;
253+ color: black;
254+ }}
248255 .removed-block {{
249256 background-color: rgba(255, 150, 150, 1);
250257 white-space: pre;
@@ -298,6 +305,9 @@ fn process_old_new(
298305 a {{
299306 color: #41a6ff;
300307 }}
308+ .filename-block {{
309+ background-color: #5f8fe5;
310+ }}
301311 .removed-block {{
302312 background-color: rgba(80, 45, 45, 1);
303313 white-space: pre;
@@ -383,7 +393,7 @@ fn process_old_new(
383393 false
384394 } ;
385395
386- let printer = HtmlDiffPrinter ( & input. interner ) ;
396+ let printer = HtmlDiffPrinter ( & input. interner , filename ) ;
387397 let diff = diff. unified_diff ( & printer, config. clone ( ) , & input) ;
388398
389399 let before_href =
@@ -482,7 +492,7 @@ enum HunkTokenStatus {
482492 Removed ,
483493}
484494
485- struct HtmlDiffPrinter < ' a > ( pub & ' a Interner < & ' a str > ) ;
495+ struct HtmlDiffPrinter < ' a > ( pub & ' a Interner < & ' a str > , pub & ' a str ) ;
486496
487497impl HtmlDiffPrinter < ' _ > {
488498 #[ expect( clippy:: unused_self, reason = "might use it later" ) ]
@@ -543,13 +553,19 @@ impl HtmlDiffPrinter<'_> {
543553impl UnifiedDiffPrinter for HtmlDiffPrinter < ' _ > {
544554 fn display_header (
545555 & self ,
546- _f : impl fmt:: Write ,
556+ mut f : impl fmt:: Write ,
547557 _start_before : u32 ,
548558 _start_after : u32 ,
549559 _len_before : u32 ,
550560 _len_after : u32 ,
551561 ) -> fmt:: Result {
552- // ignore the header as does not represent anything meaningful for the range-diff
562+ const NEW_LINE : & str = "\n " ;
563+
564+ write ! (
565+ f,
566+ r#"<span class="filename-line"> <span class="filename-block">@@</span> <b>{}</b>{NEW_LINE}</span>"# ,
567+ self . 1
568+ ) ?;
553569 Ok ( ( ) )
554570 }
555571
0 commit comments