GitHub Gists are an easy way to work with code snippets without creating a fully fledged repository.
Here’s a simple method, to embed Gist in an HTML iframe tag to an asynchronously-loaded web pages, without need of script tags in your document.
Input:
<iframe
src="https://gist.github.com/milanaryal/e9d558eae37b0aba9faeb4cbf061e970.pibb"
style="width: 100%; height: 300px; border: 0;"
>
</iframe>
Add .pibb
to the end of any Gist URL (like this) in order to get the HTML-only version suitable for embedding in any other site.
Output:
Other method:
<iframe
style="width: 100%; height: 300px; border: 0;"
src="data:text/html;charset=utf-8,
<head><base target='_blank' /></head>
<body><script src='https://gist.github.com/Albert-W/e37d1c4fa30c430c37d7b1b1fe9b60d8.js'></script>
</body>"
></iframe>
Another method:
<iframe
style="width: 100%; height: 300px; border: 0;"
srcdoc='<html><body><style type="text/css">body { margin: 0; } .gist .gist-file, .gist .gist-data { border: 0 !important; }</style><script src="https://gist.github.com/sundbry/5e0507d93d4c89023b2ba5f39f27f722.js"></script></body></html>'
></iframe>