Fix redcarpet 2 extensions and add test cases. Fixes #200

This commit is contained in:
Thomas Reynolds 2011-12-14 10:22:06 -08:00
parent 85e1918dd6
commit bc93d842dc
14 changed files with 87 additions and 5 deletions

View file

@ -2,6 +2,26 @@ Feature: Markdown support
In order to test included Maruku support In order to test included Maruku support
Scenario: Rendering html Scenario: Rendering html
Given the Server is running at "test-app" Given the Server is running at "markdown-app"
When I go to "/markdown.html" When I go to "/index.html"
Then I should see "<p>Hello World</p>" Then I should see "<p>Hello World</p>"
Scenario: Redcarpet 2 extensions
Given the Server is running at "markdown-app"
When I go to "/smarty_pants.html"
Then I should see "&ldquo;"
When I go to "/no_intra_emphasis.html"
Then I should not see "<em>"
When I go to "/tables.html"
Then I should see "<table>"
When I go to "/fenced_code_blocks.html"
Then I should see "<code>"
When I go to "/autolink.html"
Then I should see "<a href"
When I go to "/strikethrough.html"
Then I should see "<del>"
When I go to "/space_after_headers.html"
Then I should not see "<h1>"
When I go to "/superscript.html"
Then I should see "<sup>"

View file

@ -0,0 +1,9 @@
set :markdown, :smartypants => true,
:no_intra_emphasis => true,
:tables => true,
:fenced_code_blocks => true,
:autolink => true,
:strikethrough => true,
:lax_html_blocks => true,
:space_after_headers => true,
:superscript => true

View file

@ -0,0 +1,5 @@
---
layout: false
---
http://example.com

View file

@ -0,0 +1,7 @@
---
layout: false
---
~~~~~~~~~~~~~~~~~~~~~
a one-line code block
~~~~~~~~~~~~~~~~~~~~~

View file

@ -0,0 +1,4 @@
---
layout: false
---
Hello World

View file

@ -0,0 +1,5 @@
---
layout: false
---
foo_bar_baz

View file

@ -0,0 +1,5 @@
---
layout: false
---
"Hello"

View file

@ -0,0 +1,5 @@
---
layout: false
---
#this is my header

View file

@ -0,0 +1,5 @@
---
layout: false
---
~~Nope~~

View file

@ -0,0 +1,5 @@
---
layout: false
---
this is the 2^(nd) time

View file

@ -0,0 +1,8 @@
---
layout: false
---
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell

View file

@ -23,7 +23,6 @@ end
with_layout false do with_layout false do
page "/request-path.html" page "/request-path.html"
page "/lorem.html" page "/lorem.html"
page "/markdown.html"
page "/relative_image.html" page "/relative_image.html"
page "/inline-css.html" page "/inline-css.html"
page "/inline-js.html" page "/inline-js.html"

View file

@ -1 +0,0 @@
Hello World

View file

@ -2,6 +2,12 @@ module Middleman::Renderers::Markdown
class << self class << self
def registered(app) def registered(app)
require "redcarpet" require "redcarpet"
# Forcably disable Redcarpet1 support.
# Tilt defaults to this if available, but the compat
# layer disables extensions.
Object.send(:remove_const, :RedcarpetCompat) if defined? ::RedcarpetCompat
app.set :markdown_engine, :redcarpet app.set :markdown_engine, :redcarpet
app.set :markdown_engine_prefix, ::Tilt app.set :markdown_engine_prefix, ::Tilt