Github provides you with the functionality to make and embed a gist anywhere on the internet, but there's something missing, what if we want to share a gist of code from existing repo without the need of creating a new gist for it?
TLDR;
Hello there,
For anyone who works with documenting or creating how-tos and tutorials on software development, we know how hard it is to include a chunk of code in between.
There are few options that we can consider -
- We can include a code block in between and write down all the code we need to display.
- We could create a gist on GitHub, but creating and managing gists is tedious.
But then, we have the code in a repository most of the time, after all, one of the principle we developers adhere to is DRY (Don't repeat yourself).
This is where git-repo-gist comes in, as the name suggests, this utility allows you to create a gist out of any file from a GitHub repository.
Features
- Two modes available
- Script and Iframe
- Supported Languages (I suppose all the popular languages are supported but the list below is for sure)
- typescript
- javascript
- dart
- json
- php
How to use it
There are few simple steps to get gist out of code -
- Get the
uri
to theraw
file, for eghttps://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/app.js
- extract the part starting from your username till end, (everything after
https://raw.githubusercontent.com/
), we getthefallenmerc/git-repo-gist/master/app.js
- Append this to our base url with any of the option available in between, the solution is hosted at https://git-repo-gist.herokuapp.com/, thus we get
https://git-repo-gist.herokuapp.com/<option>/thefallenmerc/git-repo-gist/master/app.js
, where option can have the following value -- gist: gives back and actual gist script
- framed: gives back an iframe with the gist in it
Link to Git Repo Gist - Git Repo Gist
Github Repo Gist
This project imitates the Gist functionality provided by github but with a little twist, it works for repository source files.
View Demo · Report Bug · Request Feature
Index
Github Repo Gist
Github provides you with the functionality to make and embed a gist anywhere on the internet, but there's something missing, what if we want to share a gist of code from existing repo without the need of creating a new gist for it?
This is where this code comes in.
How to use it
There are few simple steps to get gist out of code -
- Get the
uri
to theraw
file, for eghttps://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/app.js
- extract the part starting from your username till end, (everything after
https://raw.githubusercontent.com/
), we getthefallenmerc/git-repo-gist/master/app.js
- Append this to our base url with any of the option available in between…
Top comments (0)