Sha256: cf3a4b011983d8afc6760d38a22ad7bb5362d768db9f664559086de889835078

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

# coding: UTF-8
require 'test_helper'

class CustomRenderTest < Redcarpet::TestCase
  class SimpleRender < Redcarpet::Render::HTML
    def emphasis(text)
      "<em class=\"cool\">#{text}</em>"
    end
  end

  def test_simple_overload
    md = Redcarpet::Markdown.new(SimpleRender)
    html_equal "<p>This is <em class=\"cool\">just</em> a test</p>\n",
      md.render("This is *just* a test")
  end

  class NilPreprocessRenderer < Redcarpet::Render::HTML
    def preprocess(fulldoc)
      nil
    end
  end

  def test_preprocess_returning_nil
    md = Redcarpet::Markdown.new(NilPreprocessRenderer)
    assert_equal(nil,md.render("Anything"))
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
redcarpet-3.2.3 test/custom_render_test.rb
tight-redcarpet-3.2.0 test/custom_render_test.rb
redcarpet-3.2.2 test/custom_render_test.rb
redcarpet-3.2.1 test/custom_render_test.rb
redcarpet-3.2.0 test/custom_render_test.rb
tight-redcarpet-3.1.1 test/custom_render_test.rb