Skip to content

Commit 66b3760

Browse files
committed
Added in syntax highlighting
1 parent c9f3661 commit 66b3760

File tree

7 files changed

+176
-118
lines changed

7 files changed

+176
-118
lines changed

index.html

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<title>NodeGit: Native Node bindings to Git.</title>
88
<link type="text/css" rel="stylesheet" href="styles/common.css">
9-
<link type="text/css" rel="stylesheet" href="styles/ir_black.css">
9+
<link type="text/css" rel="stylesheet" href="styles/prism.css">
1010
<link type="text/css" rel="stylesheet" href="styles/api.css">
1111
<!--
1212
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
@@ -52,12 +52,36 @@ <h4>History:</h4>
5252
and is slowly becoming a full suite of automated 1:1 bindings
5353
to libgit2.
5454
</p>
55-
<h3>Install</h3>
56-
<pre>
57-
<code>
58-
npm install nodegit
59-
</code>
60-
</pre>
55+
<h4>Install:</h4>
56+
<pre class="language-bash">
57+
<code>npm install nodegit</code></pre>
58+
<h4>Clone and read example:</h4>
59+
<pre class="language-javascript">
60+
<code>var clone = require("nodegit").Clone.clone;
61+
62+
// Clone a given repository into a tmp folder.
63+
clone("git://github.com/nodegit/nodegit", "tmp").then(function(repo) {
64+
// Use a known commit sha from this repository.
65+
var sha = "59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5";
66+
67+
// Look up this known commit.
68+
repo.getCommit(sha).then(function(commit) {
69+
// Look up a specific file within that commit.
70+
commit.getEntry("README.md").then(function(entry) {
71+
// Get the blob contents from the file.
72+
entry.getBlob().then(function(blob) {
73+
// Show the name, sha, and filesize in byes.
74+
console.log(entry.name() + entry.sha() + blob.size() + "b");
75+
76+
// Show a spacer.
77+
console.log(Array(72).join("=") + "\n\n");
78+
79+
// Show the entire file.
80+
console.log(String(blob));
81+
});
82+
});
83+
});
84+
});</code></pre>
6185
</div>
6286
<h3>API Documentation</h3>
6387
</div>
@@ -183,13 +207,8 @@ <h4>Returns:</h4>
183207

184208
<script src="api-viewer/bower_components/jquery/dist/jquery.js"></script>
185209
<script src="api-viewer/bower_components/combyne/dist/combyne.js"></script>
186-
<script src="scripts/highlight.pack.js"></script>
187-
<script src="scripts/demo.js"></script>
210+
<script src="scripts/prism.js"></script>
188211
<script src="scripts/api.js"></script>
189-
<script>
190-
hljs.tabReplace = ' ';
191-
hljs.initHighlightingOnLoad();
192-
</script>
193212
<script>
194213
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
195214
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

scripts/highlight.pack.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/prism.js

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

styles/api.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
margin-top: 0px;
6969
padding: 20px;
7070
padding-top: 10px;
71-
background: #EBEBEB;
71+
background: #F5F2F0;
7272
}
7373

7474
.api-content hr {

styles/common.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,9 @@ footer a {
181181
}
182182

183183
.wrap-content {
184-
width: 75%;
184+
width: calc(75% + 24px);
185+
}
186+
187+
pre[class*="language-"] {
188+
margin-left: -20px !important;
185189
}

styles/ir_black.css

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)