|
6 | 6 |
|
7 | 7 | <title>NodeGit: Native Node bindings to Git.</title> |
8 | 8 | <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"> |
10 | 10 | <link type="text/css" rel="stylesheet" href="styles/api.css"> |
11 | 11 | <!-- |
12 | 12 | <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> |
52 | 52 | and is slowly becoming a full suite of automated 1:1 bindings |
53 | 53 | to libgit2. |
54 | 54 | </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> |
61 | 85 | </div> |
62 | 86 | <h3>API Documentation</h3> |
63 | 87 | </div> |
@@ -183,13 +207,8 @@ <h4>Returns:</h4> |
183 | 207 |
|
184 | 208 | <script src="api-viewer/bower_components/jquery/dist/jquery.js"></script> |
185 | 209 | <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> |
188 | 211 | <script src="scripts/api.js"></script> |
189 | | - <script> |
190 | | - hljs.tabReplace = ' '; |
191 | | - hljs.initHighlightingOnLoad(); |
192 | | - </script> |
193 | 212 | <script> |
194 | 213 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
195 | 214 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
|
0 commit comments