The new GitHub Gist interface has one embed snippet for the entire gist which embeds all files in the gist. The old interface had embed code for each file in the gist. Anyone know if there's a trick to embed a single file?
Embedding with a URL To quickly embed a Gist, simply copy the gist's URL from your web browser's address bar while viewing the gist. Paste it on a line by itself in your Visual editor. Make sure that it is not hyperlinked.
In your Gist workspace, navigate to knowledge base section. Hover over the knowledge base article where you want to add an anchor, then click Edit. Scroll down to the section of the article, where you want your link to jump to. Add an ID to the element, as shown (example: id="order-delivery-process" ).
Take the gist URL from the left-hand side and after the .js
add a query string like ?file=myFile.blah
, e.g.
<script src="https://gist.github.com/4505639.js?file=macroBuild.scala" type="text/javascript"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With