jekyll-gist-tag renders the markup to embed a gist in your page in a manner that will work with or without JavaScript enabled or available. The resulting markup for the example below looks something like this:
<div class="highlight">
<div class="code">
<script src="https://gist.github.com/885179.js?file=example.htaccess.txt"></script>
<noscript>
<pre><code class="apache">
<span class="nb">redirect</span> <span class="m">301</span> /?cat=1 http://www.somesite.com/
<span class="nb">redirect</span> <span class="m">301</span> /?cat=5 http://www.somesite.com/category/standards
</code></pre>
<p><a href="https://gist.github.com/885179">This Gist</a> hosted on <a href="http://github.com/">GitHub</a>.</p>
</noscript>
</div>
</div>
This is a Jekyll plugin so it requires Jekyll, as of now it also requires Pygments as documented in the Jekyll install. I'm new to Ruby, so please excuse my code, it was unceremoniously hacked from the Jekyll source but seems to be working for me.
This tag requires Pygments to be installed, the following worked on my Mac running Yosemite, if you need different instructions please let me know:
sudo easy_install Pygments
- Add jekyll-gist-tag.rb to the _plugins directory of your Jekyll site.
- Create an entry for github_username in your _config.yml with your github username, e.g.
github_username: edelabar
. - Make sure your highlighter is set to pygments in your _config.yml, e.g.
highlighter: pygments
.
{% render_gist *gist_raw_url_with_filename* *[pygments_lexer]* }
Where:
gist_raw_url_with_filename is the gist's raw URL (e.g. https://gist.github.com/raw/885179/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt)
[pygments_lexer] is the optionally provided name of the pygments lexer for highlighting the code. If omitted, the file extension from the gist will be passed to pygments as the lexer.
The list of included lexers is available in the Pygments documentation.
{% render_gist https://gist.github.com/raw/885179/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt apache %}
Liquid Exception: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed in ...
If you run into a certificate error like the one above, you need to install a Certificate Authority bundle for ruby.
See LICENSE