github.com/yusanshi/embed-like-gist

Embed a file from GitHub repository just like GitHub Gist.

Open this visualization on its own page →

Contributors

3

Lines of Code

102

From

2019-12-16

To

2020-10-20

About yusanshi/embed-like-gist

emgithub is a web service that allows users to embed files from GitHub repositories in web pages with the simplicity of GitHub Gist embeds. The tool works in two ways: users can visit emgithub.com and paste a GitHub URL, or they can modify a GitHub file URL directly by inserting "em" before "github.com" in the address bar.

The service supports embedding code snippets, entire files, and permanent links with flexible options. Users can specify tab widths, slice code sections using line numbers, and the tool renders Markdown files and Jupyter Notebooks properly. It provides both lightweight iframe and alternative embedding options depending on platform compatibility and styling requirements. Code is displayed with syntax highlighting via Highlight.js and includes line numbers.

The project is designed for easy self-hosting, allowing developers to create their own instances for security, stability, or customization reasons. It can be deployed on GitHub Pages by forking the repository or on a custom web server like Nginx or Apache with proper 404 handling configuration. The codebase uses several open-source libraries including marked for Markdown parsing, github-markdown-css for styling, and notebookjs for Jupyter Notebook rendering.

Share this video