Wednesday, October 8, 2008

Code Syntax Highlighting on Web Pages with TextMate

Somehow I felt that there must be an easier way to achieve syntax highlighting on web pages than I described in this previous post. So after thinking and googling for some more time I came accross this cool function in TextMate:

Bundles -> TextMate -> Create HTML from Document

This creates an HTML-page of your current document. VoilĂ . And it even includes the CSS needed to make the page look like your current TextMate theme.

It also works for displaying CSS, HTML and Javascript! (and probably for every other language which can be displayed by TextMate)


Trey said...

I've been using TextMate ever since I started learning Ruby (about 3 months ago), and I never had any clue that feature was there.

I'm now using it on my site to highlight code that I post. Thanks for the great tip, Andi!

Tim said...

So great to find this tip. No more cut and pasting into and then cutting and pasting the snippet reference back into my html.