markdown, textile, etc

B

Belorion

I've been trying to use RedCloth in a rails app. According to the
documentatoin at
http://redcloth.rubyforge.org/rdoc/classes/RedCloth.html#M000051, if I
supply [:filter_html] as an option when I create a new RedCloth
instance, all html not created by RedCloth is escaped. This doesn't
appear to be the case for me, though...

%> ruby -e "require 'rubygems'; require_gem 'RedCloth', '~> 3.0.3'; r=3D
RedCloth.new( \"<b>foo</b> *bar*\", [:filter_html] ); puts r.to_html "

Gives:

<p><b>foo</b> <strong>bar</strong></p>

Clearly, the html is not being espcaped, which is contrary to the
documenation, and not what I expected to happen. Has anyone been able
to get this to work? Or, alternatively, does anyone know of a library
that will provide similar functionality? Thanks.

Matt
 
R

Ryan Leavengood

Belorion said:
Clearly, the html is not being espcaped, which is contrary to the
documenation, and not what I expected to happen. Has anyone been able
to get this to work? Or, alternatively, does anyone know of a library
that will provide similar functionality? Thanks.

I have a similar requirement in a Rails app I'm writing, and I've just
confirmed this on RedCloth 3.0.3 (which is the same version you have.)
This also presents problems for me, hmmmm.

What it does do is this:

irb(main):019:0> r = RedCloth.new("<img src='foo.jpg'/> *strong*",
[:filter_html])
=> "<img src='foo.jpg'/> *strong*"
irb(main):020:0> r.to_html
=> "<p><img> <strong>strong</strong></p>"

I'm not sure what point it is to break the HTML and even make it
non-XHTML compliant.

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top