For a community project I aim to combine RedCloth and Coderay and on
this, I might have found an issue with RedCloth.
I pushed a demo to Github:
The index (http://localhost:3000/) demonstrates the issue.
A page consist of textile. The textile contains @@@ruby somecode @@@
The textile is first feed into Coderay via a helper method and then into
RedCloth. To prevent RedCloth from applying markup to the code already
rendered by Coderay it is wrapped with which
prevent RedCloth from touching this sections.
This works with the fairly old RedCloth 4.1.1 but not with 4.1.9, 4.2.2
4.2.3. In these versions, odd effects occur doubling content (and
I am posting this here as I am quite new to Rails and uncertain, whether
this is actually a bug or an error on my side
$1 != ‘’ ? @lang = $1 : @lang = ‘none’
code = CodeRay.highlight($2, @lang, :css => :class)
Second, there is another issue which I am sure is my fault. Some problem
with safe strings I suppose - maybe you can help me out with this one:
3a.) that works: raw coderay_dressed(’@@@ruby @products = Product.all
but if I push the text to @test and call “raw coderay_dressed(@test)”
(example 3b in the index) I loose the tags.
In the show view I directly feed the @article.body “sanitize
textilize(coderay_dressed(@article.body))” this works too.
Why the difference with using a self-assigned variable and how to fix
(I tried @test.safe_html with no success).