Skip to content

Commit 56cff3d

Browse files
committed
Add special CSS for the "patch" syntax
1 parent 6c55f07 commit 56cff3d

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

src/assets/highlight.scss

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,46 @@
6464
}
6565

6666
.hljs-addition {
67-
background-color: #d4edda;
68-
69-
&::after {
70-
content: "";
71-
position: absolute;
72-
top: 1px;
73-
left: -6px;
74-
}
67+
background-color: var(--bs-success-bg-subtle)
7568
}
7669

7770
.hljs-deletion {
78-
background-color: #fae3d4;
79-
80-
&::after {
81-
content: "";
82-
position: absolute;
83-
top: 1px;
84-
left: -6px;
85-
}
71+
background-color: var(--bs-danger-bg-subtle);
8672
}
8773

88-
8974
.hljs-addition, .hljs-deletion {
9075
display: inline-block;
9176
width: 100%;
92-
position: relative;
77+
}
78+
79+
.hljs.language-patch {
80+
.hljs-addition {
81+
color: var(--bs-success);
82+
}
83+
84+
.hljs-deletion {
85+
color: var(--bs-danger);
86+
}
87+
}
88+
89+
/* Add a ✅ or ⛔ to the beginning of each line */
90+
/* NOTE: use language "patch" if you don't want this style */
91+
.hljs.language-diff {
92+
.hljs-addition, .hljs-deletion {
93+
position: relative;
94+
95+
&::after {
96+
position: absolute;
97+
top: 1px;
98+
left: -6px;
99+
}
100+
}
101+
102+
.hljs-addition::after {
103+
content: "";
104+
}
105+
106+
.hljs-deletion::after {
107+
content: "";
108+
}
93109
}

src/pages/v7/compiletime/no-member-named-reallocate/keep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ options:
1212

1313
You must add the `reallocate()` method like so:
1414

15-
```diff
15+
```patch
1616
struct SpiRamAllocator {
1717
void* allocate(size_t size) {
1818
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM);

src/pages/v7/compiletime/no-member-named-reallocate/upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ options:
1212

1313
Here is how to upgrade your code:
1414

15-
```diff
15+
```patch
1616
- struct SpiRamAllocator {
1717
+ struct SpiRamAllocator : ArduinoJson::Allocator {
1818
void* allocate(size_t size) {

0 commit comments

Comments
 (0)