Class: Nanoc3::Filters::Redcarpet

Inherits:
Nanoc3::Filter show all
Defined in:
lib/nanoc3/filters/redcarpet.rb

Overview

Since:

  • 3.2.0

Constant Summary

Constants inherited from Nanoc3::Filter

Nanoc3::Filter::TMP_BINARY_ITEMS_DIR

Instance Attribute Summary

Attributes inherited from Nanoc3::Filter

#assigns

Instance Method Summary collapse

Methods inherited from Nanoc3::Filter

#depend_on, #filename, from_binary?, #initialize, #output_filename, to_binary?, type

Methods included from PluginRegistry::PluginMethods

#identifier, #identifiers, #named, #register

Methods inherited from Context

#get_binding, #initialize

Constructor Details

This class inherits a constructor from Nanoc3::Filter

Instance Method Details

#run(content, params = {}) ⇒ String

Runs the content through [Redcarpet](github.com/tanoku/redcarpet/). This method optionally takes processing options to pass on to Redcarpet.

Parameters:

  • content (String)

    The content to filter

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :options (Array) — default: []

    A list of options to pass on to Redcarpet

Returns:

  • (String)

    The filtered content

Since:

  • 3.2.0



19
20
21
22
23
# File 'lib/nanoc3/filters/redcarpet.rb', line 19

def run(content, params={})
  options = params[:options] || []

  ::Redcarpet.new(content, *options).to_html
end