0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Kramdown syntax for embedded gists
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

>= 1.0.0
~> 2.0
~> 2.12.0
~> 0.8.3

Runtime

~> 0.14.0
 Project Readme

kramdown-gist

Build Status Code Climate

This gem extends the default kramdown parser with a new block-level element which adds support for embedding GitHub Gists via Javascript without having to hardcode <script> tags.

It has been designed with nanoc in mind, but it can be used with any other program which embeds kramdown (as long as it allows to override the parser being used.)

Installation

Add this line to your application's Gemfile:

gem 'kramdown-gist'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kramdown-gist

Usage

With nanoc

If you're using nanoc, it's sufficient to require this gem from the Rules file of your site and then pass { :input => 'KramdownGist' } as options for any instance of the kramdown filter.

Example:

require 'kramdown-gist'

compile '*.md' do
   filter :kramdown, { :input => 'KramdownGist' }
end

With standalone kramdown

Usage with standalone kramdown is similar:

require 'kramdown'
require 'kramdown-gist'

Kramdown::Document.new(content, :input => 'KramdownGist').to_html

Syntax

The extended parser class supports the same syntax as kramdown with the addition of the *{gist:<id>} block-level element. The element will be replaced with an appropriate <script> tag.

<id> should be replaced with the identifier of the Gist you wish to embed.

Known issues

LaTeX output sucks, contributions are more than welcome.

Contributing

  1. Fork
  2. Create a topic branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

GPLv3 — see COPYING for more information