# Syntax highligth with textile: Syntax+RedCloth?

**URL:** <https://www.ruby-forum.com/t/syntax-highligth-with-textile-syntax-redcloth/51442>\
**Category:** Ruby\
**Created:** [December 31, 2005, 12:24pm UTC](https://www.ruby-forum.com/t/syntax-highligth-with-textile-syntax-redcloth/51442 "2005-12-31T12:24:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriele\_renzi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e19b73/32.png) [@gabriele\_renzi](https://www.ruby-forum.com/u/gabriele_renzi)\
**Post date:** [December 31, 2005, 12:24pm UTC](https://www.ruby-forum.com/t/syntax-highligth-with-textile-syntax-redcloth/51442/1 "2005-12-31T12:24:15Z")

</div>

Hi gurus and nubys,

I was trying to mix RedCloth[1] with Syntax[2] and I’m  
facing some small problems.  
The idea is to forward parsing of

```
tags to the HTML convertor
withouth touching the rest of the code.
I thought that I could subclass RedCloth and override#smooth\_offtags
which seem quite nice since the starting
```
tag is carried till that
point, which could allow, for example, parsing of something like
```
.

The problem is in the fact that RC escapes html entities before this
step, and thus when I call #convert on the string Syntax will tokenize
them and give back bad html.

Has someone ever faced this before and has an alternate solution?

thanks in advance.

[1]http://redcloth.rubyforge.org/
[2]http://syntax.rubyforge.org
```
```
```

---

<div class="post-metadata">

**Author:** ![gabriele\_renzi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e19b73/32.png) [@gabriele\_renzi](https://www.ruby-forum.com/u/gabriele_renzi)\
**Post date:** [December 31, 2005, 12:45pm UTC](https://www.ruby-forum.com/t/syntax-highligth-with-textile-syntax-redcloth/51442/2 "2005-12-31T12:45:27Z")

</div>

On Fri, 30 Dec 2005 18:53:30 -0000, gabriele renzi  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The problem is in the fact that RC escapes html entities before this  
> step, and thus when I call #convert on the string Syntax will tokenize  
> them and give back bad html.
> 
> Has someone ever faced this before and has an alternate solution?

Yup, don’t it just suck? In the end we introduced a ‘macro’ concept by  
which we could exempt sections of code from formatting filters.

Have a browse around here:

```
http://rubyforge.org/cgi-bin/viewcvs.cgi/rote/lib/rote/?root=rote

```

Particularly inside ‘page.rb’ and the ‘filters’ directory, which has  
various filters including syntax and redcloth.

---

<div class="post-metadata">

**Author:** ![gabriele\_renzi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e19b73/32.png) [@gabriele\_renzi](https://www.ruby-forum.com/u/gabriele_renzi)\
**Post date:** [January 1, 2006, 9:32pm UTC](https://www.ruby-forum.com/t/syntax-highligth-with-textile-syntax-redcloth/51442/3 "2006-01-01T21:32:02Z")

</div>

Ross B. ha scritto:

> > which seem quite nice since the starting
> > 
> > ```
> > tag is carried till
> > Yup, don’t it just suck? In the end we introduced a ‘macro’ concept by
> > which we could exempt sections of code from formatting filters.
> > ```

yeah, I was leaning to the same solution, even if I still want to try  
out redefining to\_html with something like  
def to\_html  
expand pre tags  
super  
end

> Have a browse around here:
> 
> ```
> http://rubyforge.org/cgi-bin/viewcvs.cgi/rote/lib/rote/?root=rote
> 
> ```
> 
> Particularly inside ‘page.rb’ and the ‘filters’ directory, which has  
> various filters including syntax and redcloth.

great thanks
