Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrade to Jekyll 1.0.0.rc1 with native Redcarpet 2 support

  • Loading branch information...
commit e89224c36fc2874903a6cbebc1e96b69f8b66027 1 parent b397efc
Michael Klishin authored
View
2  Gemfile
@@ -1,6 +1,6 @@
source "https://rubygems.org"
-gem "jekyll"
+gem "jekyll", ">= 1.0.0.rc1"
gem "redcarpet"
# with Ruby 2.0 on OS X, you may need to install
# it manually with --with-iconv-dir:
View
10 README.md
@@ -10,19 +10,15 @@ With Bundler:
bundle install --binstubs
-Next, [install Pygments](http://pygments.org/docs/installation/) for code
-snippet highlighting.
-
## How to run a development server
- ./bin/jekyll --auto --server
+ ./bin/jekyll serve --watch
+then navigate to [localhost:4000](http://localhost:4000)
## How to regenerate the site
-In order to modify contents and launch dev environment, run:
-
- ./bin/jekyll
+ ./bin/jekyll build
## License & Copyright
View
3  _config.yml
@@ -5,7 +5,6 @@ auto: true
exclude: [bin, CNAME, Gemfile, Gemfile.lock, README.md]
permalink: /:title
pygments: true
-# markdown: rdiscount
-markdown: redcarpet2
+markdown: redcarpet
redcarpet:
extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "with_toc_data"]
View
35 _plugins/gist.rb
@@ -1,35 +0,0 @@
-module Jekyll
-
- #
- # Render gist
- #
- # Usage:
- #
- # {% gist gist_id %} =>
- #
- # Raises: Liquid::SyntaxError
- class Gist < ::Liquid::Tag
-
- Syntax = /(#{::Liquid::Expression}+)?/
-
- def initialize(tag_name, markup, tokens)
- if markup =~ Syntax
- @gist_id = $1
- @options = {}
- markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') }
- else
- raise ::Liquid::SyntaxError.new("Syntax Error in 'link' - Valid syntax: gist <id> <options>")
- end
-
- super
- end
-
- def render(context)
- %{<script src="http://gist.github.com/#{@gist_id}.js"></script>}
- end
- end
-
-end
-
-
-Liquid::Template.register_tag('gist', Jekyll::Gist)
View
48 _plugins/redcarpet2markdown.rb
@@ -1,48 +0,0 @@
-require 'fileutils'
-require 'digest/md5'
-require 'redcarpet'
-require 'pygments'
-
-PYGMENTS_CACHE_DIR = File.expand_path('../../_cache', __FILE__)
-FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
-
-class Redcarpet2Markdown < Redcarpet::Render::HTML
- def block_code(code, lang)
- lang = lang || "text"
- path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest code}.html")
- cache(path) do
- colorized = Albino.colorize(code, lang)
- add_code_tags(colorized, lang)
- end
- end
-
- def add_code_tags(code, lang)
- code.sub(/<pre>/, "<pre><code class=\"#{lang}\">").
- sub(/<\/pre>/, "</code></pre>")
- end
-
- def cache(path)
- if File.exist?(path)
- File.read(path)
- else
- content = yield
- File.open(path, 'w') {|f| f.print(content) }
- content
- end
- end
-end
-
-class Jekyll::MarkdownConverter
- def extensions
- Hash[ *@config['redcarpet']['extensions'].map {|e| [e.to_sym, true] }.flatten ]
- end
-
- def markdown
- @markdown ||= Redcarpet::Markdown.new(Redcarpet2Markdown.new(extensions), extensions)
- end
-
- def convert(content)
- return super unless @config['markdown'] == 'redcarpet2'
- markdown.render(content)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.