add markdown
diff --git a/_plugins/kramdown-with-pygments/README.md b/_plugins/kramdown-with-pygments/README.md
new file mode 100644
index 0000000..9663c42
--- /dev/null
+++ b/_plugins/kramdown-with-pygments/README.md
@@ -0,0 +1,70 @@
+Kramdown with Pygments
+========
+A Jekyll plugin that enables Pygments syntax highlighting for Kramdown-parsed fenced code blocks.
+Heavily based on [krampygs](https://github.com/navarroj/krampygs), but refactored to make it work with Jekyll 2.*.
+
+In the standard setup, Jekyll Kramdown only works with Pygments for syntax highlighting
+when you use Liquid tags. This plugin makes Kramdown also use Pygments when using
+fenced code blocks. That way you can use more Markdown and less Liquid. Yay!
+
+## Usage
+
+* Clone this project into your `_plugins` directory.
+* Add the following lines to your `_config.yml`
+
+```yaml
+markdown: KramdownPygments
+```
+
+Fenced code blocks can now be syntax highlighted using the power of Pygments.
+
+
+ ~~~php
+ print "Hello World"
+ ~~~
+
+
+The same goes for inline code:
+
+ You could also do something like this: `var foo = 'bar'`{:.language-javascript}. Amazing!
+
+## Setting the default language
+If you don't want to set the language for inline code blocks like that every time,
+you can define a global default language for the entire site in your `_config.yml`
+
+```yaml
+kramdown:
+ default_lang: php
+```
+
+If you want to override that for a single page, add the following at the top of
+that page, but below the front-matter
+
+```
+{::options kramdown_default_lang="php" /}
+```
+
+## Options
+This plugin supports all options that the original kramdown converter supports:
+
+```yaml
+kramdown:
+ auto_ids: true
+ footnote_nr: 1
+ entity_output: as_char
+ toc_levels: 1..6
+ smart_quotes: lsquo,rsquo,ldquo,rdquo
+ input: GFM
+```
+
+## Tested with
+
+* kramdown 1.4.0
+* pygments.rb 0.6.0
+* jekyll 2.1.1
+* ruby 2.0.0p451
+
+## Thanks
+
+This plugin is heavily based on [krampygs](https://github.com/navarroj/krampygs).
+Thanks to [@navarroj](https://github.com/navarroj) for developing the original plugin.
diff --git a/_plugins/kramdown-with-pygments/kramdown_pygments.rb b/_plugins/kramdown-with-pygments/kramdown_pygments.rb
new file mode 100644
index 0000000..74f279a
--- /dev/null
+++ b/_plugins/kramdown-with-pygments/kramdown_pygments.rb
@@ -0,0 +1,92 @@
+# We define the an additional option for the kramdown parser to look for
+module Kramdown
+ module Options
+ define(:kramdown_default_lang, Symbol, nil, <<EOF)
+Sets the default language for highlighting code blocks
+
+If no language is set for a code block, the default language is used
+instead. The value has to be one of the languages supported by pygments
+or nil if no default language should be used.
+
+Default: nil
+Used by: PygmentsHtml converter
+EOF
+ end
+end
+
+# This class is a plugin for kramdown, to make it use pygments instead of coderay
+# It has nothing to do with Jekyll, it is simply used by the custom converter below
+module Kramdown
+ module Converter
+ class PygmentsHtml < Html
+
+ begin
+ require 'pygments'
+ rescue LoadError
+ STDERR.puts 'You are missing a library required for syntax highlighting. Please run:'
+ STDERR.puts ' $ [sudo] gem install pygments'
+ raise FatalException.new("Missing dependency: Pygments")
+ end
+
+ def convert_codeblock(el, indent)
+ attr = el.attr.dup
+ lang = extract_code_language!(attr) || @options[:kramdown_default_lang]
+ code = pygmentize(el.value, lang)
+ code_attr = {}
+ code_attr['class'] = "language-#{lang}" if lang
+ "#{' '*indent}<div class=\"highlight\"><pre#{html_attributes(attr)}><code#{html_attributes(code_attr)}>#{code}</code></pre></div>\n"
+ end
+
+ def convert_codespan(el, indent)
+ attr = el.attr.dup
+ lang = extract_code_language!(attr) || @options[:kramdown_default_lang]
+ code = pygmentize(el.value, lang)
+ if lang
+ attr['class'] = "highlight"
+ if attr.has_key?('class')
+ attr['class'] += " language-#{lang}"
+ else
+ attr['class'] = "language-#{lang}"
+ end
+ end
+ "<code#{html_attributes(attr)}>#{code}</code>"
+ end
+
+ def pygmentize(code, lang)
+ if lang
+ Pygments.highlight(code,
+ :lexer => lang,
+ :options => { :startinline => true, :encoding => 'utf-8', :nowrap => true })
+ else
+ escape_html(code)
+ end
+ end
+ end
+ end
+end
+
+# This class is the actual custom Jekyll converter.
+class Jekyll::Converters::Markdown::KramdownPygments
+
+ def initialize(config)
+ require 'kramdown'
+ @config = config
+ rescue LoadError
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
+ STDERR.puts ' $ [sudo] gem install kramdown'
+ raise FatalException.new("Missing dependency: kramdown")
+ end
+
+ def convert(content)
+ html = Kramdown::Document.new(content, {
+ :auto_ids => @config['kramdown']['auto_ids'],
+ :footnote_nr => @config['kramdown']['footnote_nr'],
+ :entity_output => @config['kramdown']['entity_output'],
+ :toc_levels => @config['kramdown']['toc_levels'],
+ :smart_quotes => @config['kramdown']['smart_quotes'],
+ :kramdown_default_lang => @config['kramdown']['default_lang'],
+ :input => @config['kramdown']['input']
+ }).to_pygments_html
+ return html;
+ end
+end