Permalink
Browse files

strip the trailing whitespace from content in preformatted blocks

  • Loading branch information...
mislav committed Jul 17, 2009
1 parent e14a91a commit 5934d32c65504075311e5348e2f787727630580d
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/remark.rb
  2. +1 −0 spec/remark_spec.rb
View
@@ -103,7 +103,7 @@ def remark_element(elem)
elem.children.any? { |e| e.elem? and BLOCK.include?(e.name) } ?
remark_block(elem).indent : remark_inline(elem)
when 'pre'
- elem.inner_text.indent
+ elem.inner_text.rstrip.indent
when 'em'
"_#{remark_inline(elem)}_"
when 'strong'
View
@@ -100,6 +100,7 @@ def remark(source, options = {})
it "should support preformatted blocks" do
remark("<pre>def foo\n bar\nend</pre>").should == " def foo\n bar\n end"
remark("<pre><code>def foo\n &lt;bar&gt;\nend</code></pre>").should == " def foo\n <bar>\n end"
+ remark("<pre>def foo\n</pre>").should == " def foo"
end
it "should remark inline elements" do

0 comments on commit 5934d32

Please sign in to comment.