Skip to content

Commit 37401d7

Browse files
authored
Merge pull request #180 from rtfpessoa/improve-line-heigth
Improve line heigth
2 parents 39f8d9b + 7fbc8c2 commit 37401d7

13 files changed

+68
-93
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"parserOptions": {
33
"ecmaVersion": 6,
44
"ecmaFeatures": {
5-
"experimentalObjectRestSpread": true,
65
"jsx": true
76
},
87
"sourceType": "module"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ If your favourite language is not included in the default package also add its j
240240

241241
```html
242242
<!-- Stylesheet -->
243-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
243+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css">
244244
<link rel="stylesheet" type="text/css" href="dist/diff2html.css">
245245

246246
<!-- Javascripts -->
247247
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
248-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
249-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/scala.min.js"></script>
248+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
249+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/scala.min.js"></script>
250250
<script type="text/javascript" src="dist/diff2html-ui.js"></script>
251251
```
252252

docs/demo.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<!-- Custom styles for this template -->
3434
<link href="main.min.css" rel="stylesheet">
3535

36-
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
36+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css">
3737

3838
<!-- diff2html -->
3939
<link rel="stylesheet" type="text/css" href="assets/diff2html.min.css">
@@ -240,8 +240,8 @@ <h3>Thank you</h3>
240240
}
241241
</script>
242242

243-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
244-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/scala.min.js"></script>
243+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
244+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/scala.min.js"></script>
245245

246246
<!-- diff2html -->
247247
<script type="text/javascript" src="assets/diff2html.min.js"></script>

src/templates/diff2html-templates.js

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

src/templates/file-summary-line.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li class="d2h-file-list-line">
22
<span class="d2h-file-name-wrapper">
3-
<span>{{>fileIcon}}</span>
3+
{{>fileIcon}}
44
<a href="#{{fileHtmlId}}" class="d2h-file-name">{{fileName}}</a>
55
<span class="d2h-file-stats">
66
<span class="d2h-lines-added">{{addedLines}}</span>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<span class="d2h-file-name-wrapper">
2-
<span class="d2h-icon-wrapper">{{>fileIcon}}</span>
2+
{{>fileIcon}}
33
<span class="d2h-file-name">{{fileDiffName}}</span>
44
{{>fileTag}}
55
</span>

src/ui/css/diff2html.css

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
}
1111

1212
.d2h-file-header {
13+
height: 35px;
1314
padding: 5px 10px;
1415
border-bottom: 1px solid #d8d8d8;
1516
background-color: #f7f7f7;
@@ -58,7 +59,6 @@
5859
white-space: nowrap;
5960
text-overflow: ellipsis;
6061
overflow-x: hidden;
61-
line-height: 21px;
6262
}
6363

6464
.d2h-file-wrapper {
@@ -76,7 +76,7 @@
7676

7777
.d2h-diff-tbody > tr > td {
7878
height: 20px;
79-
line-height: 20px;
79+
line-height: 1;
8080
}
8181

8282
.d2h-files-diff {
@@ -103,14 +103,12 @@
103103
display: inline-block;
104104
white-space: nowrap;
105105
padding: 0 10px;
106-
margin-left: 80px;
107106
}
108107

109108
.d2h-code-side-line {
110109
display: inline-block;
111110
white-space: nowrap;
112111
padding: 0 10px;
113-
margin-left: 50px;
114112
}
115113

116114
.d2h-code-line del,
@@ -168,7 +166,6 @@
168166

169167
.d2h-code-linenumber {
170168
box-sizing: border-box;
171-
position: absolute;
172169
width: 86px;
173170
padding-left: 2px;
174171
padding-right: 2px;
@@ -182,7 +179,6 @@
182179

183180
.d2h-code-side-linenumber {
184181
box-sizing: border-box;
185-
position: absolute;
186182
width: 56px;
187183
padding-left: 5px;
188184
padding-right: 5px;
@@ -285,10 +281,6 @@
285281
cursor: pointer;
286282
}
287283

288-
.d2h-icon-wrapper {
289-
line-height: 31px;
290-
}
291-
292284
.d2h-icon {
293285
vertical-align: middle;
294286
margin-right: 10px;

test/diff2html-tests.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ var filesExample1 =
5757
' <ol class="d2h-file-list">\n' +
5858
' <li class="d2h-file-list-line">\n' +
5959
' <span class="d2h-file-name-wrapper">\n' +
60-
' <span><svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"\n' +
61-
' viewBox="0 0 14 16" width="14">\n' +
62-
' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>\n' +
63-
'</svg></span>\n' +
64-
' <a href="#d2h-675094" class="d2h-file-name">sample</a>\n' +
60+
' <svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"\n' +
61+
' viewBox="0 0 14 16" width="14">\n' +
62+
' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>\n' +
63+
' </svg> <a href="#d2h-675094" class="d2h-file-name">sample</a>\n' +
6564
' <span class="d2h-file-stats">\n' +
6665
' <span class="d2h-lines-added">+1</span>\n' +
6766
' <span class="d2h-lines-deleted">-1</span>\n' +
@@ -76,10 +75,9 @@ var htmlLineExample1 =
7675
' <div id="d2h-675094" class="d2h-file-wrapper" data-lang="">\n' +
7776
' <div class="d2h-file-header">\n' +
7877
' <span class="d2h-file-name-wrapper">\n' +
79-
' <span class="d2h-icon-wrapper"><svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
80-
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
81-
'</svg></span>\n' +
82-
' <span class="d2h-file-name">sample</span>\n' +
78+
' <svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
79+
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
80+
' </svg> <span class="d2h-file-name">sample</span>\n' +
8381
' <span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>\n' +
8482
' </div>\n' +
8583
' <div class="d2h-file-diff">\n' +
@@ -128,10 +126,9 @@ var htmlSideExample1 =
128126
' <div id="d2h-675094" class="d2h-file-wrapper" data-lang="">\n' +
129127
' <div class="d2h-file-header">\n' +
130128
' <span class="d2h-file-name-wrapper">\n' +
131-
' <span class="d2h-icon-wrapper"><svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
132-
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
133-
'</svg></span>\n' +
134-
' <span class="d2h-file-name">sample</span>\n' +
129+
' <svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
130+
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
131+
' </svg> <span class="d2h-file-name">sample</span>\n' +
135132
' <span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>\n' +
136133
' </div>\n' +
137134
' <div class="d2h-files-diff">\n' +
@@ -317,10 +314,9 @@ describe('Diff2Html', function() {
317314
' <div id="d2h-211439" class="d2h-file-wrapper" data-lang="md">\n' +
318315
' <div class="d2h-file-header">\n' +
319316
' <span class="d2h-file-name-wrapper">\n' +
320-
' <span class="d2h-icon-wrapper"><svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
321-
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
322-
'</svg></span>\n' +
323-
' <span class="d2h-file-name">CHANGELOG.md</span>\n' +
317+
' <svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">\n' +
318+
' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>\n' +
319+
' </svg> <span class="d2h-file-name">CHANGELOG.md</span>\n' +
324320
' <span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>\n' +
325321
' </div>\n' +
326322
' <div class="d2h-file-diff">\n' +

0 commit comments

Comments
 (0)