lib/redcarpet.rb in redcarpet-3.0.0 vs lib/redcarpet.rb in redcarpet-3.1.0
- old
+ new
@@ -1,9 +1,9 @@
require 'redcarpet.so'
module Redcarpet
- VERSION = '3.0.0'
+ VERSION = '3.1.0'
class Markdown
attr_reader :renderer
end
@@ -66,13 +66,13 @@
end
def to_html(*_dummy)
@markdown.render(@text)
end
-
+
private
-
+
EXTENSION_MAP = {
# old name => new name
:autolink => :autolink,
:fenced_code => :fenced_code_blocks,
:filter_html => :filter_html,
@@ -93,31 +93,31 @@
:gh_blockcode => nil,
:no_tables => nil,
:smart => nil,
:strict => nil
}
-
- RENDERER_OPTIONS = [:filter_html, :no_images, :no_links, :no_styles,
+
+ RENDERER_OPTIONS = [:filter_html, :no_images, :no_links, :no_styles,
:safe_links_only, :with_toc_data, :hard_wrap, :prettify, :xhtml]
-
+
def rename_extensions(exts)
exts.map do |old_name|
if new_name = EXTENSION_MAP[old_name]
new_name
else
old_name
end
end.compact
end
-
+
# Returns two hashes, the extensions and renderer options
# given the extension list
def parse_extensions_and_renderer_options(exts)
exts = rename_extensions(exts)
exts.partition {|ext| !RENDERER_OPTIONS.include?(ext) }.
map {|list| list_to_truthy_hash(list) }
end
-
+
# Turns a list of symbols into a hash of <tt>symbol => true</tt>.
def list_to_truthy_hash(list)
list.inject({}) {|h, k| h[k] = true; h }
end
end