# How to format and syntax highlight code in html

**URL:** <https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186>\
**Category:** Rails\
**Created:** [February 26, 2006, 2:32am UTC](https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186 "2006-02-26T02:32:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [February 26, 2006, 2:32am UTC](https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186/1 "2006-02-26T02:32:30Z")

</div>

I’ve written my own blog (I know typo is better, but I wanted the  
experience of writing my own) and I want to add syntax highlighting to  
it. I’ve read about using the ruby gem syntax but I can’t figure out  
how to implement it. I’ve also wondered if it could be used in my case.  
How does it work when you have a long line of code but the

 your  
writing in is narrow? How would you fix this problem?

charlie bowman  
[recentrambles.com](http://recentrambles.com)

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [February 26, 2006, 10:47pm UTC](https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186/2 "2006-02-26T22:47:23Z")

</div>

Has no one tried to display code on thier blog? I know that there must  
be a good way of doing it.

charlie bowman wrote:

> I’ve written my own blog (I know typo is better, but I wanted the  
> experience of writing my own) and I want to add syntax highlighting to  
> it. I’ve read about using the ruby gem syntax but I can’t figure out  
> how to implement it. I’ve also wondered if it could be used in my case.  
> How does it work when you have a long line of code but the
> 
> your  
> writing in is narrow? How would you fix this problem?
> 
> charlie bowman  
> [recentrambles.com](http://recentrambles.com)

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [February 26, 2006, 11:18pm UTC](https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186/3 "2006-02-26T23:18:43Z")

</div>

Take a look at the typo source and browse the code related to text  
filter used for syntax.

[http://www.typosphere.org/trac/browser/trunk](http://www.typosphere.org/trac/browser/trunk)

There are lots of good things to learn from viewing Typo code besides  
this too… 🙂

-Sean

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [February 27, 2006, 2:24am UTC](https://www.ruby-forum.com/t/how-to-format-and-syntax-highlight-code-in-html/54186/4 "2006-02-27T02:24:48Z")

</div>

thanks, I didn’t even think about that.

charlie bowman  
[recentrambles.com](http://recentrambles.com)

Sean S. wrote:

> Take a look at the typo source and browse the code related to text  
> filter used for syntax.
> 
> [http://www.typosphere.org/trac/browser/trunk](http://www.typosphere.org/trac/browser/trunk)
> 
> There are lots of good things to learn from viewing Typo code besides  
> this too… 🙂
> 
> -Sean
