diff --git a/Gemfile b/Gemfile index fe0c9380d..3a5ae2b84 100755 --- a/Gemfile +++ b/Gemfile @@ -2,13 +2,6 @@ source 'https://rubygems.org' gemspec name: 'solargraph' -if RUBY_VERSION =~ /^2\.(1|2)\./ - gem 'kramdown', '~> 1.16' -else - gem 'kramdown', '~> 2.0' - gem 'kramdown-parser-gfm', '~> 1.0' -end - # Local gemfile for development tools, etc. local_gemfile = File.expand_path(".Gemfile", __dir__) instance_eval File.read local_gemfile if File.exist? local_gemfile diff --git a/lib/solargraph/page.rb b/lib/solargraph/page.rb index 9ef6a409f..35d4233cc 100644 --- a/lib/solargraph/page.rb +++ b/lib/solargraph/page.rb @@ -2,7 +2,7 @@ require 'ostruct' require 'tilt' -require 'kramdown' +require 'redcarpet' require 'htmlentities' require 'cgi' @@ -24,17 +24,8 @@ def initialize locals, render_method # @param text [String] # @return [String] def htmlify text - Kramdown::Document.new( - text.to_s.lines.map{|l| l.gsub(/^ /, "\t")}.join, - input: 'GFM', - entity_output: :symbolic, - syntax_highlighter_opts: { - block: { - line_numbers: false - }, - default_lang: :ruby - }, - ).to_html + redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML) + redcarpet.render(text.to_s.lines.map{|l| l.gsub(/^ /, "\t")}.join) end # @param code [String] diff --git a/lib/solargraph/pin/documenting.rb b/lib/solargraph/pin/documenting.rb index f0d4206d7..293382f7c 100644 --- a/lib/solargraph/pin/documenting.rb +++ b/lib/solargraph/pin/documenting.rb @@ -2,27 +2,19 @@ require 'rdoc' require 'reverse_markdown' -require 'kramdown' -begin - require 'kramdown-parser-gfm' -rescue LoadError - Solargraph.logger.info "Using legacy kramdown #{Kramdown::VERSION}" -end +require 'redcarpet' module Solargraph module Pin # A module to add the Pin::Base#documentation method. # module Documenting + [].join # @return [String] def documentation @documentation ||= begin - html = Kramdown::Document.new( - normalize_indentation(docstring.to_s), - input: 'GFM', - entity_output: :symbolic, - syntax_highlighter: nil - ).to_html + redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML) + html = redcarpet.render(normalize_indentation(docstring.to_s)) ReverseMarkdown.convert(html, github_flavored: true).lines.map(&:rstrip).join("\n") end end diff --git a/solargraph.gemspec b/solargraph.gemspec index 02fade40a..402dc5c29 100755 --- a/solargraph.gemspec +++ b/solargraph.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| end s.homepage = 'http://solargraph.org' s.license = 'MIT' - s.executables = ['solargraph', 'solargraph-runtime'] + s.executables = ['solargraph'] s.required_ruby_version = '>= 2.1' @@ -23,9 +23,9 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'bundler', '>= 1.17.2' s.add_runtime_dependency 'htmlentities', '~> 4.3', '>= 4.3.4' s.add_runtime_dependency 'jaro_winkler', '~> 1.5' - s.add_runtime_dependency 'kramdown', '>= 1.16' s.add_runtime_dependency 'nokogiri', '>= 1.9.1' s.add_runtime_dependency 'parser', '~> 2.3' + s.add_runtime_dependency 'redcarpet', '~> 3.4' s.add_runtime_dependency 'reverse_markdown', '~> 1.0', '>= 1.0.5' s.add_runtime_dependency 'rubocop', '~> 0.52' s.add_runtime_dependency 'thor', '~> 0.19', '>= 0.19.4'