Skip to content

Commit f21492f

Browse files
committed
add HightlightJS
1 parent f9f9945 commit f21492f

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

dist/diff2html.css

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Diff to HTML (diff2html.css)
44
* Author: rtfpessoa
55
* Date: Friday 29 August 2014
6-
* Last Update: Saturday 27 September 2014
6+
* Last Update: Sunday 25 January 2015
77
*
88
*/
99

@@ -86,22 +86,32 @@
8686
margin-right: -4px;
8787
}
8888

89-
.d2h-code-line {
89+
.d2h-code-line.hljs {
90+
display: block;
9091
white-space: pre;
91-
padding-left: 10px;
92-
padding-right: 10px;
92+
padding: 0 10px;
9393
height: 18px;
9494
line-height: 18px;
9595
margin-left: 80px;
96+
/* Override HighlightJS */
97+
color: inherit;
98+
overflow-x: inherit;
99+
background: none;
100+
/* ******************** */
96101
}
97102

98103
.d2h-code-side-line {
104+
display: block;
99105
white-space: pre;
100-
padding-left: 10px;
101-
padding-right: 10px;
106+
padding: 0 10px;
102107
height: 18px;
103108
line-height: 18px;
104109
margin-left: 50px;
110+
/* Override HighlightJS */
111+
color: inherit;
112+
overflow-x: inherit;
113+
background: none;
114+
/* ******************** */
105115
}
106116

107117
.d2h-code-line del,

dist/template.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,29 @@
88
Diff to HTML (template.html)
99
Author: rtfpessoa
1010
Date: Friday 29 August 2014
11-
Last Update: Sunday 14 September 2014
11+
Last Update: Sunday 25 January 2015
1212
-->
1313

14+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
1415
<link rel="stylesheet" type="text/css" href="{{css}}">
16+
17+
18+
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
19+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
20+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/languages/scala.min.js"></script>
21+
<script>
22+
$(document).ready(function () {
23+
var code = $(".d2h-code-line");
24+
code.map(function (i, line) {
25+
hljs.highlightBlock(line);
26+
});
27+
28+
var codeSide = $(".d2h-code-side-line");
29+
codeSide.map(function (i, line) {
30+
hljs.highlightBlock(line);
31+
});
32+
});
33+
</script>
1534
</head>
1635
<body style="text-align: center; font-family: 'Source Sans Pro',sans-serif;">
1736
<h1>Diff to HTML by <a href="https://github.com/rtfpessoa">rtfpessoa</a></h1>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "diff2html",
3-
"version": "0.1.6-2",
3+
"version": "0.1.6-3",
44

55
"homepage": "https://www.github.com/rtfpessoa/diff2html-nodejs",
66
"description": "Fast Diff to colorized HTML",

src/diff2html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Diff to HTML (diff2html.js)
44
* Author: rtfpessoa
55
* Date: Friday 29 August 2014
6-
* Last Update: Saturday 24 January 2015
6+
* Last Update: Sunday 25 January 2015
77
*
88
* Diff commands:
99
* git diff

0 commit comments

Comments
 (0)