Sha256: 732fd0ec3c9a1a4650084710396a02776f9f946a16b43071011b3f7194b50e79
Contents?: true
Size: 873 Bytes
Versions: 7
Compression:
Stored size: 873 Bytes
Contents
module Moft module Converters class Markdown class RDiscountParser def initialize(config) require 'rdiscount' @config = config @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym } rescue LoadError STDERR.puts 'You are missing a library required for Markdown. Please run:' STDERR.puts ' $ [sudo] gem install rdiscount' raise FatalException.new("Missing dependency: rdiscount") end def convert(content) rd = RDiscount.new(content, *@rdiscount_extensions) html = rd.to_html if rd.generate_toc and html.include?(@config['rdiscount']['toc_token']) html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content.force_encoding('utf-8')) end html end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems