Permalink
Browse files

Merge pull request #8 from stokito/patch-1

Code highlight
  • Loading branch information...
2 parents 621d025 + b88dc62 commit 4925f8d21634f24410018ae949d40a1b47bb191f @jamesward committed Dec 17, 2013
Showing with 28 additions and 28 deletions.
  1. +28 −28 README.md
View
56 README.md
@@ -6,37 +6,37 @@ A simple jQuery plugin that pulls a file from github.com and returns it.
This uses the public GitHub API (v3) over JSONP to pull a raw file from GitHub.
API:
-
- $.getGithubFile(user, repo, sha, callback, startLineNum, endLineNum)
-
+```javascript
+$.getGithubFile(user, repo, sha, callback, startLineNum, endLineNum)
+```
or
-
- $.getGithubFileByFilePath(user, repo, filePath, callback, startLineNum, endLineNum)
-
+```javascript
+$.getGithubFileByFilePath(user, repo, filePath, callback, startLineNum, endLineNum)
+```
Examples:
-
- // fetch this README.md file and return all of the lines
- $.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
- console.log(contents)
- });
+```javascript
+// fetch this README.md file and return all of the lines
+$.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
+ console.log(contents)
+});
- // fetch this README.md file and return all of the lines beginning with line 6
- $.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
- console.log(contents)
- }, 6);
+// fetch this README.md file and return all of the lines beginning with line 6
+$.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
+ console.log(contents)
+}, 6);
- // fetch this README.md file and return lines 6 - 15
- $.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
- console.log(contents)
- }, 6, 15);
-
- // fetch this README.md file and return all of the lines
- $.getGithubFileByFilePath("jamesward", "github-files", "README.md", function(contents) {
- console.log(contents)
- });
-
+// fetch this README.md file and return lines 6 - 15
+$.getGithubFile("jamesward", "github-files", "2e7bf4aa35758d7a9cf87549d6299e924737ff05", function(contents) {
+ console.log(contents)
+}, 6, 15);
+
+// fetch this README.md file and return all of the lines
+$.getGithubFileByFilePath("jamesward", "github-files", "README.md", function(contents) {
+ console.log(contents)
+});
+```
To get the sha for a file in git run something like:
-
- git rev-parse HEAD:README.md
-
+```bash
+git rev-parse HEAD:README.md
+```
or use the `$.getGithubFileByFilePath` method as documented above.

0 comments on commit 4925f8d

Please sign in to comment.