0

Is there a way I can embed the code in a file present in github repository into a page of site being developed on node js.

Simplest I can think of is invoke a ajax call and pull the content into a dom element on the page.

Is there any other way out?

EDIT

Code on github is not nodejs code. A use case: I have ruby code committed and shared on github, now I want to refer that code on a site being created using nodejs.

4
  • Where should the code from Github run (server or client)? What is the problem with your suggestion? Why do you want to embed code directly from Github instead of just downloading it? Commented Dec 2, 2017 at 16:25
  • Edited the post to add clarity Commented Dec 2, 2017 at 16:30
  • As per my knowledge you can embed a gist, not a repository. Commented Dec 2, 2017 at 16:33
  • Would you be able to make do with directly fetching the code over HTTP and then converting it into your display format, or do you need some sort of custom embed logic? Commented Dec 2, 2017 at 16:34

1 Answer 1

1

Gist-it is your solution for it. A man named "Robert Krimen" is kind enough to create an application so that we can embed any file from github repository to our webpage/blog. You can do it as simple as in three steps, just like you embed a gist, hoping you are familiar with embedding gist.

Copy github url of the file you like to embed.

Submit it to Gist-it and copy the script tag generated.

Use the script tag copied in you blog, same as you use gist.

for further reference http://blog.revathskumar.com/2012/08/embed-files-from-github-repository-into-webpage.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.