GithubHelp home page GithubHelp logo

mbabineau / jekyll-gist-tag Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edelabar/jekyll-gist-tag

0.0 3.0 0.0 104 KB

A Liquid Tag for use with Jekyll to render Gists with both script and noscript representations

License: MIT License

Ruby 100.00%

jekyll-gist-tag's Introduction

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/edelabar/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/edelabar/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/edelabar/885179/raw/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/edelabar/885179/raw/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt apache %}

Troubleshooting

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.

License

See LICENSE

jekyll-gist-tag's People

Contributors

edelabar avatar mopsled avatar mbabineau avatar saipanno avatar

Watchers

 avatar David Smith avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.