# New RedCloth

**URL:** <https://www.ruby-forum.com/t/new-redcloth/143984>\
**Category:** Radiant CMS\
**Created:** [July 24, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984 "2008-07-24T12:06:31Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/1 "2008-07-24T12:06:31Z")

</div>

Have you seen this announcement?

[http://feeds.feedburner.com/~r/RubyInside/~3/342732232/redcloth-4-released-962.html](http://feeds.feedburner.com/~r/RubyInside/~3/342732232/redcloth-4-released-962.html)

Apart from dropping of Markdown support (does radiant use it?), it  
could be interesting to update it.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 3:44pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/2 "2008-07-24T15:44:58Z")

</div>

How would people feel about switching to a gem dependency on the latest  
RedCloth (instead of packaging it)?

Sean

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 5:06pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/3 "2008-07-24T17:06:38Z")

</div>

I’m fine with it. Looks like a good improvement too.

Now all we need is a better Markdown parser.

-Chris

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 5:17pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/4 "2008-07-24T17:17:13Z")

</div>

Someone was working on a branch that uses rdiscount, an improved  
Markdown parser.

Sean

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/5 "2008-07-24T17:24:41Z")

</div>

It’s a bit of a detour from Radiant being geared toward shared hosting.

John M. is working on a branch than uses RDiscount (which is a  
better Markdown parser).  
[http://github.com/johnmuhl/radiant/tree/markdown](http://github.com/johnmuhl/radiant/tree/markdown)

On Jul 24, 2008, at 11:05 AM, Chris P. wrote:

> > Sean
> > 
> > Ollivier R. wrote:
> > 
> > > Have you seen this announcement?
> > > 
> > > [RedCloth 4.0 Released: 40x Faster Textile Rendering](http://feeds.feedburner.com/~r/RubyInside/~3/342732232/redcloth-4-)  
> > > released-962.html
> > > 
> > > Apart from dropping of Markdown support (does radiant use it?), it  
> > > could be interesting to update it.

Jim G.

> **[Saturn Flyer](https://www.saturnflyer.com/)**
>
> Home info

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/6 "2008-07-24T17:35:53Z")

</div>

That was my main concern… I’d like to continue packaging the library  
with Radiant, but it is no longer pure-Ruby and must be compiled. That  
said, RubyGems has greatly improved since we started down this road.

Sean

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 5:32pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/7 "2008-07-24T17:32:22Z")

</div>

I understood discoount to be \*nix only (no Windows). I’ll have to look  
into it further.

-Chris

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/8 "2008-07-24T19:54:16Z")

</div>

On 2008/07/24, at 07:44, Sean C. wrote:

> How would people feel about switching to a gem dependency on the  
> latest RedCloth (instead of packaging it)?

I think it’s going to have to happen at some point unless Radiant  
wants to keep using the same old text parsing libraries from  
2004/2005. Waiting for the pure ruby libraries catch back up is the  
other (wishful) option.

On 2008/07/24, at 09:31, Chris P. wrote:

> I understood discoount to be \*nix only (no Windows). I’ll have to  
> look into it further.

That’s right. Although there isn’t anything really stopping it from  
being compiled for windows with mingw just like they did RedCloth 4;  
except of course finding people who use windows to do the work 🙂  
There is also PEG markdown (rpeg-markdown in ruby land) but right now  
it is completely unusable on big (huge?) spans of text and I’m not  
sure it’s any easier to get running in windows. Personally, I’d rather  
have a PEG based Markdown than a Discount based one.

As far as getting a new Markdown parser into core I’d say don’t even  
bother yet. As has been stated Discount doesn’t (yet) run on windows,  
and PEG Markdown is crashy (and probably doesn’t run on windows either).

I would definitely like to see Radiant upgrade to RedCloth 4 sometime  
soon. If no one jumps up to take it on in the next week, I’ll try to  
get it running then.

p.s. I did put together a standalone Markdown filter that uses  
rdiscount, so if you can install gems and don’t run windows you can  
use that until something better is in the core. I use it on live sites  
with no problems (some were even started with the standard Markdown  
filter and upgraded without issue).

[http://github.com/johnmuhl/radiant-markdown-extension](http://github.com/johnmuhl/radiant-markdown-extension)

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 24, 2008, 9:19pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/9 "2008-07-24T21:19:25Z")

</div>

I saw somewhere that Luis L. was researching porting rDiscount to  
Windows but also that it didn’t look good (discount depends on some \*nix  
only libraries, I think)

Hopefully I’m wrong, though.

Either way, I didn’t mean to hijack a thread. New Redcloth for all!

-Chris

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 26, 2008, 11:35am UTC](https://www.ruby-forum.com/t/new-redcloth/143984/10 "2008-07-26T11:35:32Z")

</div>

On Thu, Jul 24, 2008 at 9:18 PM, Chris P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I saw somewhere that Luis L. was researching porting rDiscount to  
> Windows but also that it didn’t look good (discount depends on some \*nix  
> only libraries, I think)
> 
> Hopefully I’m wrong, though.
> 
> Either way, I didn’t mean to hijack a thread. New Redcloth for all!

Thread-hijacking… 🙂

rDiscount uses some neat posic tricks that allow them use callbacks  
from file operations in a in-memory file (mapped file). This function  
is name funopen and fopencookie.

There is no way to recreate that in Windows, tried and failed (maybe  
because my C-fu is not good enough). There are better ways that the  
same can be accomplished but we should be careful not to exploit with  
huge memory buffers.

## Maybe someone can write a ragel for markdown and we all enjoy a BlueCloth like the new RedCloth? 😉

## Luis L. AREA 17

Human beings, who are almost unique in having the ability to learn from  
the experience of others, are also remarkable for their apparent  
disinclination to do so.  
Douglas Adams

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 30, 2008, 7:23pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/11 "2008-07-30T19:23:07Z")

</div>

How do I try the new RedCloth 4 with radiant? I do remember seeing  
instructions somewhere.

Jasper

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [July 27, 2008, 4:16am UTC](https://www.ruby-forum.com/t/new-redcloth/143984/12 "2008-07-27T04:16:34Z")

</div>

Jim G. wrote:

> It’s a bit of a detour from Radiant being geared toward shared hosting.
> 
> John M. is working on a branch than uses RDiscount (which is a  
> better Markdown parser).  
> [http://github.com/johnmuhl/radiant/tree/markdown](http://github.com/johnmuhl/radiant/tree/markdown)

Simply gem unpack. Easy peasy. Also, Webfaction is one of the best in  
terms of shared hosting, rails and radiantcms.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [August 25, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/13 "2008-08-25T23:01:10Z")

</div>

Make that:

# Get the latest version of RedCloth

Object.send :remove\_const, :RedCloth if Object.const\_defined?  
(:RedCloth) && RedCloth::VERSION.is\_a?(String)  
$:.delete File.join(RADIANT\_ROOT, ‘vendor’, ‘redcloth’, ‘lib’)  
gem ‘RedCloth’, ‘\>= 4.0.3’  
require ‘RedCloth’

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [August 26, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/14 "2008-08-26T22:00:11Z")

</div>

Jasper,

I’ve just put out a redcloth4 Radiant extension:  
[http://ext.radiantcms.org/extensions/28-redcloth4](http://ext.radiantcms.org/extensions/28-redcloth4)

Give that a try.

Jasper Kooij wrote:

> How do I try the new RedCloth 4 with radiant? I do remember seeing  
> instructions somewhere.
> 
> Jasper

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [August 25, 2008, 10:24pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/15 "2008-08-25T22:24:50Z")

</div>

I just sent a pull request to make RedCloth a gem dependency, so  
hopefully edge will have that ability soon.

In the meantime, I used some code like this in an extension:

# Get the latest version of RedCloth

Object.send :remove\_const, :RedCloth if Object.const\_defined?(:RedCloth)  
$:.delete File.join(RADIANT\_ROOT, ‘vendor’, ‘redcloth’, ‘lib’)  
gem ‘RedCloth’, ‘\>= 4.0.3’  
require ‘RedCloth’

Hope it works for you.

Jason

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [October 3, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/16 "2008-10-03T17:00:12Z")

</div>

Jasper Kooij wrote:

> Hi Jason,
> 
> I’ve tried to load it using the extension way but that failed.
> 
> [~/radiant]# script/extension redcloth4

You have to specify an action to do with the extension, like install:

# script/extension install redcloth4

That works perfectly. You’d get the same error if you tried  
script/extension page\_attachments

Hope the extension is working out well for you!

Jason

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [September 27, 2008, 6:34am UTC](https://www.ruby-forum.com/t/new-redcloth/143984/17 "2008-09-27T06:34:36Z")

</div>

Hi Jason,

I’ve tried to load it using the extension way but that failed. Then I  
did the git way and that worked fine :

[~/radiant]# script/extension redcloth4  
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/vendor/rails/activeresource/lib/…/…/activesupport/lib/active\_support/dependencies.rb:263:in  
`load_missing_constant': uninitialized constant Radiant::Extension::Script::Redcloth4 (NameError) from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/vendor/rails/activeresource/lib/../../activesupport/lib/active_support/dependencies.rb:453:in`const\_missing’  
from  
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/lib/radiant/extension/script.rb:193:in  
`const_get' from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.9/lib/radiant/extension/script.rb:193:in`execute’  
from script/extension:5  
[~/radiant]# cd ~/radiant  
[~/radiant]# git clone  
git://github.com/jgarber/radiant-redcloth4-extension.git  
vendor/extensions/redcloth4  
Initialized empty Git repository in  
/home/xxxx/radiant/vendor/extensions/redcloth4/.git/  
remote: Counting objects: 16, done.  
remote: Compressing objects: 100% (16/16), done.  
remote: Total 16 (delta 4), reused 0 (delta 0)  
Receiving objects: 100% (16/16), 11.14 KiB, done.  
Resolving deltas: 100% (4/4), done.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [October 3, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/new-redcloth/143984/18 "2008-10-03T17:05:10Z")

</div>

Jason G. wrote:

> Jasper Kooij wrote:
> 
> > Hi Jason,
> > 
> > I’ve tried to load it using the extension way but that failed.
> > 
> > [~/radiant]# script/extension redcloth4
> 
> You have to specify an action to do with the extension, like install:
> 
> # script/extension install redcloth4
> 
> That works perfectly. You’d get the same error if you tried  
> script/extension page\_attachments
> 
> Hope the extension is working out well for you!
> 
> Jason

Hi Jason,

Thanks for pointing that out that i’ve missed the obvious! I am using  
it, trying to get the hang of redcloth. I relly don’t want to install a  
wysiwyg unless i have to.

Thanks

Jasper
