An open API service indexing awesome lists of open source software.

https://github.com/studiole/readgithub

A jQuery plugin to load files from GitHub
https://github.com/studiole/readgithub

Last synced: about 1 year ago
JSON representation

A jQuery plugin to load files from GitHub

Awesome Lists containing this project

README

          

# readGitHub.js

A jQuery plugin to load GitHub files into your page

## Install

Packages are available via Bower and NPM

```
npm install --save readgithub
```

```
bower install --save readgithub
```

## Use

Include `dist/css/readgithub.css` and `dist/js/readgithub.js` in your page, ensuring jQuery is loaded first.

``` html

```

Add the following line whereever you would like to render a file from GitHub:

``` html


```

Finally, call the readGitHub method in your javascript

``` js
$(document).ready(function() {
$('[rel~="github"]').readGitHub()
})
```

readGitHub will look for the `rel="github"` and read the requested repository from `data-repo`.

## Configuration

A number of configuration options are available. One of the most powerful features is the option to use a renderer. For instance you can declare a Markdown render, read your `README.md` and readGitHub will load and convert your `.md` as html.

### Using a renderer

``` js
$('[rel~="github"]').readGitHub({
renderer: function(file) {
// Your render function
return file
}
})
```

For instance to render with markdown-it include the script before `readGitHub.js`.

``` html

```

And use the following within your javascript

``` js
$('[rel~="github"]').readGitHub({
renderer: function(file) {
return window.markdownit().render(file)
}
})
```