File tree Expand file tree Collapse file tree 2 files changed +59
-1
lines changed
Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -559,6 +559,16 @@ ${content}`,
559559 prism : {
560560 theme : prismThemes . github ,
561561 darkTheme : prismThemes . dracula ,
562+ magicComments : [
563+ {
564+ className : 'code-block-diff-add-line' ,
565+ line : 'diff-add'
566+ } ,
567+ {
568+ className : 'code-block-diff-remove-line' ,
569+ line : 'diff-remove'
570+ }
571+ ]
562572 } ,
563573 } ) ,
564574} ;
Original file line number Diff line number Diff line change 8585
8686.button--secondary : hover {
8787 background-color : var (--ifm-color-secondary-light );
88- }
88+ }
89+
90+ /* Code diff highlighting start */
91+ .code-block-diff-add-line {
92+ background-color : # ccffd8 ;
93+ display : block;
94+ margin : 0 -40px ;
95+ padding : 0 40px ;
96+ }
97+
98+ .code-block-diff-add-line ::before {
99+ position : absolute;
100+ left : 8px ;
101+ padding-right : 8px ;
102+ content : '+' ;
103+ }
104+
105+ .code-block-diff-remove-line {
106+ background-color : # ffebe9 ;
107+ display : block;
108+ margin : 0 -40px ;
109+ padding : 0 40px ;
110+ }
111+
112+ .code-block-diff-remove-line ::before {
113+ position : absolute;
114+ left : 8px ;
115+ padding-right : 8px ;
116+ content : '-' ;
117+ }
118+
119+ /**
120+ * use magic comments to mark diff blocks
121+ */
122+ pre code : has (.code-block-diff-add-line ) {
123+ padding-left : 40px !important ;
124+ }
125+
126+ pre code : has (.code-block-diff-remove-line ) {
127+ padding-left : 40px !important ;
128+ }
129+
130+ [data-theme = "dark" ] pre code .token-line .code-block-diff-add-line {
131+ background-color : # 4A5827 ;
132+ }
133+ [data-theme = "dark" ] pre code .token-line .code-block-diff-remove-line {
134+ background-color : # 542936 ;
135+ }
136+ /* Code diff highlighting end */
You can’t perform that action at this time.
0 commit comments