-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
123 lines (101 loc) · 10.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diff Highlight Pro</title>
<link rel="stylesheet" href="./css/styles.css">
<link rel="stylesheet" href="./css/prism.css">
<link rel="stylesheet" href="./css/prism-diff-min.css">
<link rel="stylesheet" href="./css/diff-highlight-pro.css">
</head>
<body>
<div class="content">
<div class="main">
<h2>If you find "Diff Highlight" that uses Prism complicated, this is a much easier alternative...</h2>
<br><br>
<hr>
<br><br>
<h2>Code with "Default Prism Diff Highlight"</h2>
<pre><code class="language-markup"></code>
<pre class="language-diff-javascript line-numbers" tabindex="0"><code class="diff-highlight language-diff-javascript"><span class="token coord">@@ -4,6 +4,5 @@</span>
<span class="token deleted-sign deleted language-javascript"><span class="token prefix deleted">-</span> <span class="token keyword">let</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prefix deleted">-</span> foo <span class="token operator">=</span> foo <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token inserted-sign inserted language-javascript"><span class="token prefix inserted">+</span> <span class="token keyword">const</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token unchanged language-javascript"><span class="token prefix unchanged"> </span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">\`</span><span class="token string">foo: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">\${</span>foo<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">\`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span></span></code></pre>
</code></pre>
<p>With line numbers (Add class="line-numbers")</p>
<pre class="language-diff-javascript line-numbers" tabindex="0"><code class="diff-highlight language-diff-javascript"><span class="token coord">@@ -4,6 +4,5 @@</span>
<span class="token deleted-sign deleted language-javascript"><span class="token prefix deleted">-</span> <span class="token keyword">let</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prefix deleted">-</span> foo <span class="token operator">=</span> foo <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token inserted-sign inserted language-javascript"><span class="token prefix inserted">+</span> <span class="token keyword">const</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token unchanged language-javascript"><span class="token prefix unchanged"> </span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">\`</span><span class="token string">foo: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">\${</span>foo<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">\`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span></span></code></pre>
<p>Without line numbers (Remove class="line-numbers")</p>
<pre class="language-diff-javascript" tabindex="0"><code class="diff-highlight language-diff-javascript"><span class="token coord">@@ -4,6 +4,5 @@</span>
<span class="token deleted-sign deleted language-javascript"><span class="token prefix deleted">-</span> <span class="token keyword">let</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prefix deleted">-</span> foo <span class="token operator">=</span> foo <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token inserted-sign inserted language-javascript"><span class="token prefix inserted">+</span> <span class="token keyword">const</span> foo <span class="token operator">=</span> bar<span class="token punctuation">.</span><span class="token function">baz</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
</span><span class="token unchanged language-javascript"><span class="token prefix unchanged"> </span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">\`</span><span class="token string">foo: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">\${</span>foo<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">\`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span></span></code></pre>
<br><br>
<hr>
<br><br>
<h2>Code with "Diff Highlight Pro"</h2>
<pre><code class="language-javascript">
<pre data-line-red="2,3" data-line-green="4" data-line-yellow="5" class="line-numbers">
<code class="language-javascript"><br>
@@ -4,6 +4,5 @@<br>
let foo = bar.baz([1, 2, 3]);<br>
foo = foo + 1;<br>
const foo = bar.baz([1, 2, 3]) + 1;<br>
console.log(`foo: ${foo}`);<br>
</code>
</pre><br>
</code></pre>
<p>With line numbers (Add class="line-numbers")</p>
<pre data-line-red="2,3" data-line-green="4" data-line-yellow="5" class="line-numbers"><code class="language-javascript">
@@ -4,6 +4,5 @@
let foo = bar.baz([1, 2, 3]);
foo = foo + 1;
const foo = bar.baz([1, 2, 3]) + 1;
console.log(\`foo: \${foo}\`);
</code></pre>
<p>Without line numbers (Remove class="line-numbers")</p>
<pre data-line-red="2,3" data-line-green="4" data-line-yellow="5" class=""><code class="language-javascript">
@@ -4,6 +4,5 @@
let foo = bar.baz([1, 2, 3]);
foo = foo + 1;
const foo = bar.baz([1, 2, 3]) + 1;
console.log(\`foo: \${foo}\`);
</code></pre>
<br><br>
<hr>
<br><br>
<h2>Mode of Use</h2>
<br>
<p>Add:</p>
<link rel="stylesheet" href="./css/diff-highlight-pro.css"><br>
<script src="./js/diff-highlight-pro.js"></script><br>
<br>
<p>data-line-red="" for red lines</p>
<p>data-line-green="" for green lines</p>
<p>data-line-yellow="" for yellow lines</p>
<br>
<p>Single line --> 4</p>
<p>Two lines --> 4,8</p>
<p>Range --> 4-6</p>
<p>Mixed --> 4,6-7</p>
<br>
<pre><code class="language-javascript">
<pre data-line-red="2,3" data-line-green="4" data-line-yellow="5" class="line-numbers">
<code class="language-javascript"><br>
Your Code...
</code>
</pre><br>
</code></pre>
</div>
</div>
<script src="./js/prism.js"></script>
<script src="./js/components/prism-diff.min.js"></script>
<script src="./js/diff-highlight-pro.js"></script>
</body>
</html>