Skip to content

Commit 60633be

Browse files
committed
fix: fix highlighting for empty diff lines
1 parent 748be60 commit 60633be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/Pre.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export default function Pre({
103103
const content = code
104104
.split('\n')
105105
.map((line) => {
106-
if (line.startsWith('+ ')) {
107-
return `// diff-add\n${line.replace(/^\+ /, '')}`;
108-
} else if (line.startsWith('- ')) {
109-
return `// diff-remove\n${line.replace(/^- /, '')}`;
106+
if (line.startsWith('+')) {
107+
return `// diff-add\n${line.replace(/^\+\s?/, '')}`;
108+
} else if (line.startsWith('-')) {
109+
return `// diff-remove\n${line.replace(/^-\s?/, '')}`;
110110
}
111111

112112
return line;

0 commit comments

Comments
 (0)