Skip to content

Commit 0f38d68

Browse files
committed
add inserted + deleted highlighting
1 parent 5529121 commit 0f38d68

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

example/content.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
}
77
```
88

9+
```diff
10+
- hello
11+
+ world
12+
```
13+
914
# Deno
1015

1116
[![Build Status - Cirrus][]][Build status] [![Twitter handle][]][Twitter badge]

example/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import "https://esm.sh/[email protected]/components/prism-tsx?no-check&pin=v57";
88
import "https://esm.sh/[email protected]/components/prism-bash?no-check&pin=v57";
99
import "https://esm.sh/[email protected]/components/prism-powershell?no-check&pin=v57";
1010
import "https://esm.sh/[email protected]/components/prism-json?no-check&pin=v57";
11+
import "https://esm.sh/[email protected]/components/prism-diff?no-check&pin=v57";
1112

1213
const CONTENT_PATH = new URL("./content.md", import.meta.url);
1314

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ build:
44
echo "/** @type {string} */\nexport const CSS = \``cat style/dist/main.css`\`;" > style.js
55

66
dev:
7-
deno run --allow-net --allow-read --unstable --watch --no-check ./example/main.ts
7+
deno run -A --unstable --watch --no-check ./example/main.ts

mod.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export function render(markdown: string, opts: RenderOptions = {}): string {
106106
"script",
107107
"plain-text",
108108
"property",
109+
"prefix",
110+
"line",
111+
"deleted",
112+
"inserted",
109113
],
110114
a: ["anchor"],
111115
svg: ["octicon", "octicon-link"],

style.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

style/main.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,14 @@
7676
&.tag .token.tag, &.property {
7777
color: var(--color-prettylights-syntax-entity-tag);
7878
}
79+
80+
&.deleted {
81+
color: var(--color-prettylights-syntax-markup-deleted-text);
82+
background-color: var(--color-prettylights-syntax-markup-deleted-bg);
83+
}
84+
85+
&.inserted {
86+
color: var(--color-prettylights-syntax-markup-inserted-text);
87+
background-color: var(--color-prettylights-syntax-markup-inserted-bg);
88+
}
7989
}

0 commit comments

Comments
 (0)