Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Liquid Tag for use with Jekyll to render Gists with both script and noscript representations
Branch: master
Pull request Compare This branch is 13 commits behind edelabar:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README.markdown
jekyll-gist-tag.rb

README.markdown

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>

Requirements

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.

Installation

Add jekyll-gist-tag.rb to the _plugins directory of your Jekyll site

Usage

{% 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.

Example

{% render_gist https://gist.github.com/raw/885179/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt apache %}

License

See LICENSE

Something went wrong with that request. Please try again.