diff --git a/Gemfile b/Gemfile index 1f31549e..08ab18af 100644 --- a/Gemfile +++ b/Gemfile @@ -76,7 +76,6 @@ group :jekyll_optional_dependencies do gem "classifier-reborn", "~> 2.2.0" gem "liquid-c", "~> 3.0" gem "pygments.rb", "~> 1.0" - gem "rdiscount", "~> 2.0" gem "yajl-ruby", "~> 1.3" end diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 4baa36a8..698c59bc 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -65,14 +65,6 @@ Feature: Site configuration And the "_site/Rakefile" file should not exist And the "_site/README" file should not exist - Scenario: Use RDiscount for markup - Given I have an "index.markdown" page that contains "[Google](https://www.google.com)" - And I have a configuration file with "markdown" set to "rdiscount" - When I run jekyll build - Then I should get a zero exit status - And the _site directory should exist - And I should see "Google" in "_site/index.html" - Scenario: Use Kramdown for markup Given I have an "index.markdown" page that contains "[Google](https://www.google.com)" And I have a configuration file with "markdown" set to "kramdown" diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index fb51cd5b..e49eb62b 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -66,10 +66,6 @@ module Jekyll "strict_variables" => false, }, - "rdiscount" => { - "extensions" => [], - }, - "kramdown" => { "auto_ids" => true, "toc_levels" => "1..6", diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 567bc120..3c1c3458 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -30,8 +30,7 @@ module Jekyll # rubocop:disable Naming/AccessorMethodName def get_processor case @config["markdown"].downcase - when "kramdown" then return KramdownParser.new(@config) - when "rdiscount" then return RDiscountParser.new(@config) + when "kramdown" then return KramdownParser.new(@config) else custom_processor end @@ -43,7 +42,7 @@ module Jekyll # are not in safe mode.) def valid_processors - %w(rdiscount kramdown) + third_party_processors + %w(kramdown) + third_party_processors end # Public: A list of processors that you provide via plugins. @@ -52,7 +51,7 @@ module Jekyll def third_party_processors self.class.constants - \ - %w(KramdownParser RDiscountParser PRIORITIES).map( + %w(KramdownParser PRIORITIES).map( &:to_sym ) end diff --git a/lib/jekyll/converters/markdown/rdiscount_parser.rb b/lib/jekyll/converters/markdown/rdiscount_parser.rb deleted file mode 100644 index 9da177d4..00000000 --- a/lib/jekyll/converters/markdown/rdiscount_parser.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module Jekyll - module Converters - class Markdown - class RDiscountParser - def initialize(config) - unless defined?(RDiscount) - Jekyll::External.require_with_graceful_fail "rdiscount" - end - @config = config - @rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym) - end - - def convert(content) - rd = RDiscount.new(content, *@rdiscount_extensions) - html = rd.to_html - if @config["rdiscount"]["toc_token"] - html = replace_generated_toc(rd, html, @config["rdiscount"]["toc_token"]) - end - html - end - - private - def replace_generated_toc(rd_instance, html, toc_token) - if rd_instance.generate_toc && html.include?(toc_token) - utf8_toc = rd_instance.toc_content - utf8_toc.force_encoding("utf-8") if utf8_toc.respond_to?(:force_encoding) - html.gsub(toc_token, utf8_toc) - else - html - end - end - end - end - end -end diff --git a/test/helper.rb b/test/helper.rb index a3cd6568..9e01b7de 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -34,10 +34,6 @@ require_relative "../lib/jekyll.rb" Jekyll.logger = Logger.new(StringIO.new, :error) -unless jruby? - require "rdiscount" -end - require "kramdown" require "shoulda" diff --git a/test/test_rdiscount.rb b/test/test_rdiscount.rb deleted file mode 100644 index 7116c29a..00000000 --- a/test/test_rdiscount.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "helper" - -class TestRdiscount < JekyllUnitTest - context "rdiscount" do - setup do - if jruby? - then skip( - "JRuby does not perform well with CExt, test disabled." - ) - end - - config = { - "markdown" => "rdiscount", - "rdiscount" => { - "toc_token" => "{:toc}", - "extensions" => %w(smart generate_toc), - }, - } - - @markdown = Converters::Markdown.new config - end - - should "pass rdiscount extensions" do - assert_equal "
“smart”
", @markdown.convert('"smart"').strip - end - - should "render toc" do - toc = <<-TOC - -