Embedding code snippets in your blog with Gist and 2 things to fix when nothing shows up
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.
To embed a gist, it’s (nearly) as simply as to copy the embed link
And paste the HTML into your blog.
Here is an example
But if anything doesn’t show up, you may need to check two things.
// Copied code (not fixed) <script src="https://gist.github.com/2603939.js?file=gist+example.m"></script> // Fixed working HTML tag <script src="https://gist.github.com/2603939.js?file=gist%2Bexample.m"> </script>
- Escape the file name parameter, notice the
%2Bin my example
- Add a white space between
<script></script>tag so the the parsing engine won’t rewrite into
<script src="..." />, which some browser has issues displaying naked HTML tags.
Btw, remember that the gist won’t show up in tumblr’s preview mode.