# Line Breaks in Textile

**URL:** <https://www.ruby-forum.com/t/line-breaks-in-textile/135395>\
**Category:** Radiant CMS\
**Created:** [April 21, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395 "2008-04-21T20:37:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 21, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/1 "2008-04-21T20:37:37Z")

</div>

Sorry if this question doesn’t belong here, but I figured one of you  
guys might know the answer.

I just set up a fresh 0.66 installation and am using Textile to format  
the pages I write.

Everything is working wonderfully except that line breaks do not  
generate “  
” tags. Instead, they simply make a new line in the HTML  
code. Example:

Paragraph one.

Paragraph  
two.

…should render:

Paragraph one

Paragraph  
two

…instead, it renders:

Paragraph one

Paragraph two

Is this a recent change in Textile or something Radiant-specific? On the  
“Textile Tryout” page ([http://www.textism.com/tools/textile/index.php](http://www.textism.com/tools/textile/index.php))  
it DOES insert the “  
” tag. However on the “Textile Reference” page  
([Textile Reference](http://hobix.com/textile/)) under “Line Breaks”, the author seems to say  
that “  
” is no longer part of the functionality.

Have any of you guys had problems with this?

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 21, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/2 "2008-04-21T20:42:59Z")

</div>

Ben,

RedCloth (the Ruby implementation of Textile) does not necessarily  
follow the Textism version exactly. If you need   
 tags, just put  
them in there and it will oblige.

Sean

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 21, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/3 "2008-04-21T21:09:24Z")

</div>

Ben,  
RedCloth is the Ruby library Radiant uses to format Textile.  
Unfortunately, the latest release 3.0.4 is notoriously awful. The  
upcoming release, 4.0, adheres to the official Textile 2 reference  
exactly, including the line breaks you speak of. I recommend you  
give the pre-release testing gem a try.

$ gem install RedCloth --source [http://code.whytheluckystiff.net](http://code.whytheluckystiff.net)

(Note that RedCloth is camel case.) Make sure it’s working by  
opening up irb and typing RedCloth::VERSION and noting the version  
number is higher than 3.0.4.

That alone probably won’t work for your Radiant install because  
Radiant includes RedCloth in the vendor directory rather than  
allowing it to be loaded from gems. You either have to remove that  
directory or, if you’re using Radiant in instance mode, add this hack  
to the environment.rb file after the require ‘boot’ and before the  
require ‘radius’.

# \*\*\* hack to get RedCloth out of vendor \*\*\*\*

$:.reject! {|p| p =~ /vendor/redcloth/ }

Then check that it’s installed properly by starting Radiant’s  
console: ./script/console and typing RedCloth::VERSION.

RedCloth 4.0 will probably be released by May 1.

Jason G.

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 1:19am UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/4 "2008-04-22T01:19:52Z")

</div>

Jason,

Thanks for that information! I attempted the hack, however after  
following your instructions, the RedCloth version still appears to be  
3.04. I checked the console on a regular rails directory just to make  
sure I had correctly installed the newer version of the RedCloth gem…  
and indeed I had.

That said, it’s not really a time-critical app, so if 4.0 will indeed  
be out by the 1st, that’ll work just fine.

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 3:14am UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/5 "2008-04-22T03:14:00Z")

</div>

Ben,

Well, if it’s not working with the 3.290 gem, it won’t work any  
better with 4.0. The problem is with Radiant. I’ll try it tomorrow  
with 0.6.6 and see what I can come up with.

Jason

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 3:26am UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/6 "2008-04-22T03:26:51Z")

</div>

Jason,

You seem really up-to-date on the progress of RedCloth. Since it’s  
being reimplemented in Ragel, will the code still be pure Ruby, or will  
it be part-Ruby, part-C?

Sean

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 1:21pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/7 "2008-04-22T13:21:27Z")

</div>

Part Ruby, part C. It could also be Java—Ragel outputs Ruby, C,  
Java, and many others—but someone has to write the Java glue. So  
far, no one has stepped forward. 🙂

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/8 "2008-04-22T13:45:44Z")

</div>

Hi Jason,

As Java developer I could take a look at it, I’m don’t have alot of free  
time at the moment, but I can always give a look !

Could you send me some information / documentation ?

Regards

Peter.

On Tue, Apr 22, 2008 at 1:20 PM, Jason G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > being reimplemented in Ragel, will the code still be pure Ruby, or will it
> > 
> > > see what I can come up with.
> > > 
> > > > 3.04. I checked the console on a regular rails directory just to
> > > > 
> > > > * * *
> > > 
> > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)  
> > > Radiant mailing list  
> > > Post: removed\_email\_address@domain.invalid  
> > > Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
met vriendelijke groet,

Peter B.

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 4:50pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/9 "2008-04-22T16:50:34Z")

</div>

Jason G. wrote:

> Well, if it’s not working with the 3.290 gem, it won’t work any  
> better with 4.0.

Sorry for the confusion, I meant that line breaks DO work with the 3.29  
gem. However, I couldn’t get Radiant to use 3.29.

After using the hack you posted my Radiant console still reports  
RedCloth’s version is 3.04.

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 22, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/10 "2008-04-22T17:16:44Z")

</div>

Ben,

Try adding the path to the gem to the front of config.load\_paths in  
environment.rb. Example:

config.load\_paths.unshift “/path/to/gems/RedCloth-3.2.9.0/lib”

Sean

---

<div class="post-metadata">

**Author:** ![glenatron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@glenatron](https://www.ruby-forum.com/u/glenatron)\
**Post date:** [April 24, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/line-breaks-in-textile/135395/11 "2008-04-24T17:35:12Z")

</div>

Ben,

Sean’s suggestion worked for me in an instance of Radiant 0.6.0.

Added…  
config.load\_paths.unshift “/usr/local/lib/ruby/gems/1.8/gems/  
RedCloth-3.290/lib/”

inside the Radiant::Initializer block. Your gem path will vary.
