Skip to content

Commit 314a65e

Browse files
author
Rodrigo Fernandes
committed
Merge pull request #2 from rtfpessoa/cleaning
clean the readme and template
2 parents 336da58 + 784c75f commit 314a65e

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

README.md

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# Diff to Html Node Module (CLI) by [rtfpessoa](https://github.com/rtfpessoa)
1+
# Diff to Html CLI by [rtfpessoa](https://github.com/rtfpessoa)
22

3-
Diff to Html generates pretty HTML diffs.
4-
5-
### Inspiration
6-
7-
This project is just a CLI for [diff2html-nodejs](https://github.com/rtfpessoa/diff2html-nodejs).
3+
Diff to Html generates pretty HTML diffs from git diff output in your terminal
84

95
## Features
106

@@ -16,17 +12,23 @@ This project is just a CLI for [diff2html-nodejs](https://github.com/rtfpessoa/d
1612

1713
* GitHub like style
1814

15+
* Code syntax highlight
16+
1917
## Online Example
2018

2119
> Go to [Diff2HTML](http://rtfpessoa.github.io/diff2html/)
2220
23-
## Other Distributions
21+
## Distributions
2422

2523
* [WebJar](http://www.webjars.org/)
2624

27-
* Manually download and import [diff2html.js](https://github.com/rtfpessoa/diff2html) into your page
25+
* [Node Module](https://www.npmjs.org/package/diff2html)
26+
27+
* [Bower Package](http://bower.io/search/?q=diff2html)
28+
29+
* [Node CLI](https://www.npmjs.org/package/diff2html-cli)
2830

29-
* Import Node library [diff2html-nodejs](https://github.com/rtfpessoa/diff2html-nodejs) into your package.json
31+
* Manually download and import `rtfpessoa/diff2html/dist/diff2html.min.js` into your page
3032

3133
## Setup
3234

@@ -47,14 +49,24 @@ This project is just a CLI for [diff2html-nodejs](https://github.com/rtfpessoa/d
4749
-s, --side Side by Side diff.
4850
-j, --json Export diff in json format.
4951

50-
## Contribution
52+
Example:
5153

52-
All contributions are welcome.
54+
diff2html -p -l "HEAD~1"
5355

54-
To contribute just send a pull request with your feature,fix,... and it will be reviewed asap.
56+
> NOTE: notice the " in the example
57+
58+
## Contributions
59+
60+
All the contributions are welcome.
61+
62+
To contribute just send a pull request with your changes and I will review it asap.
5563

5664
## License
5765

5866
Copyright 2014 Rodrigo Fernandes. Released under the terms of the MIT license.
5967

68+
## Thanks
69+
70+
This project is inspired in [pretty-diff](https://github.com/scottgonzalez/pretty-diff) by [Scott González](https://github.com/scottgonzalez).
71+
6072
---

dist/template.html

+11-10
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@
1212
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/github.min.css">
1313
<link rel="stylesheet" type="text/css" href="{{css}}">
1414

15-
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
1615
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
1716
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/languages/scala.min.js"></script>
1817
<script>
19-
$(document).ready(function () {
20-
var allFileLanguages = $(".d2h-file-wrapper").map(function (i, file) {
21-
return $(file).data("lang");
18+
document.addEventListener("DOMContentLoaded", function () {
19+
// collect all the distinct languages in the HTML
20+
var distinctLanguages = [];
21+
[].forEach.call(document.getElementsByClassName("d2h-file-wrapper"), function (file) {
22+
distinctLanguages.indexOf(file.dataset.lang) === -1 && distinctLanguages.push(file.dataset.lang);
2223
});
23-
var distinctLanguages = allFileLanguages.filter(function (i, v) {
24-
return $.inArray(v, allFileLanguages) == i;
25-
});
26-
hljs.configure({languages: distinctLanguages.toArray()});
2724

28-
var code = $(".d2h-code-line-ctn");
29-
code.map(function (i, line) {
25+
// pass the languages to the highlightjs plugin
26+
hljs.configure({languages: distinctLanguages});
27+
28+
// collect all the code lines and execute the highlight on them
29+
var codeLines = document.getElementsByClassName("d2h-code-line-ctn");
30+
[].forEach.call(codeLines, function (line) {
3031
hljs.highlightBlock(line);
3132
});
3233
});

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "diff2html-cli",
3-
"version": "0.2.4",
3+
"version": "0.2.4-1",
44

5-
"homepage": "https://www.github.com/rtfpessoa/diff2html-nodejs-cli",
5+
"homepage": "https://www.github.com/rtfpessoa/diff2html-cli",
66
"description": "Fast Diff to colorized HTML",
77
"keywords": [
88
"git",
@@ -29,11 +29,11 @@
2929

3030
"repository": {
3131
"type": "git",
32-
"url": "https://www.github.com/rtfpessoa/diff2html-nodejs-cli.git"
32+
"url": "https://www.github.com/rtfpessoa/diff2html-cli.git"
3333
},
3434

3535
"bugs": {
36-
"url": "https://www.github.com/rtfpessoa/diff2html-nodejs-cli/issues"
36+
"url": "https://www.github.com/rtfpessoa/diff2html-cli/issues"
3737
},
3838

3939
"engines": {

0 commit comments

Comments
 (0)