Class: Converters::Markdown::Paru
- Inherits:
-
Object
- Object
- Converters::Markdown::Paru
- Defined in:
- lib/jekyll-paru.rb
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config) ⇒ Paru
constructor
A new instance of Paru.
Constructor Details
#initialize(config) ⇒ Paru
Returns a new instance of Paru.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-paru.rb', line 8 def initialize config External.require_with_graceful_fail 'paru/pandoc' @config = config @paru = ::Paru::Pandoc.new do self.class.class_variable_set :@@pandoc_exec, config['paru']&.[]('exec') || self.class.class_variable_get(:@@pandoc_exec) @options = config['paru']&.[]('options')&.dup || {} @options['from'] ||= 'markdown' @options['to'] ||= 'html5' @options.each do |key, value| default = ::Paru::Pandoc::OPTIONS[key] if default.nil? @options.delete key Jekyll.logger.warn 'Paru:', "Unknown option #{key}, ignoring" elsif default.is_a? Array @options[key] = [value].flatten end end end end |
Instance Method Details
#convert(content) ⇒ Object
29 30 31 |
# File 'lib/jekyll-paru.rb', line 29 def convert content @paru.convert content end |