Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.
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 post/page editor.
We take care of the rest! The gist will look something like this.
Embedding with a Shortcode
You can also embed a gist by using a shortcode. You can do this by first copying the gist URL from your web browser’s address bar while viewing the gist.
Then create a shortcode using the format below. Be sure to replace the URL listed here with the URL of your gist, and the code is on a line by itself.
[gist https://gist.github.com/2314628 /]
You can also create a gist shortcode using just the gist ID.
- Make sure the gist URL is not hyperlinked. If the URL is shown in your theme’s link color (as the second line in the screenshot below), then it is hyperlinked. Simply select the whole URL and click the “Unlink” icon on your Visual Editor toolbar.
Once the URL is unlinked, you will see the link text in black.
- Make sure to place the gist URL or shortcode on its own line. This means there should be no character or whitespace before or after the URL/shortcode.