7

Do you guys know a syntax highlighter capable of highlighting mixed PHP+HTML+CSS+JS code?

like:

<?php
 echo 'foo';
?>
<div> foo </div>
<style type="text/css">
  .foo {color: #3d3;}
</style>

I only know GeShi so far. It's pretty cool, but it only supports one language at a time.

Alex
  • 66,732
  • 177
  • 439
  • 641
  • Are you looking for an IDE or you want to highlight code in a web page you are rendering? – Darin Dimitrov Apr 02 '11 at 18:09
  • in a web site, highlight before output – Alex Apr 02 '11 at 18:11
  • @Alexndra, great, thanks for the clarification. I guess I didn't read your question carefully. – Darin Dimitrov Apr 02 '11 at 18:12
  • 1
    i know this doesn't do fully what you want, but there is something to be said for the php highlight_string() function. – dqhendricks Apr 02 '11 at 18:14
  • also, most people use client side javascript solutions for this, because highlighting string during output each time a page is requested is very taxing on a server, and highlighting on input makes future editing a pain. – dqhendricks Apr 02 '11 at 18:16
  • possible duplicate of [PHP syntax highlighting](http://stackoverflow.com/questions/230270/php-syntax-highlighting) – Gordon Apr 02 '11 at 18:22

1 Answers1

8

It's not PHP, but Pygments is awesome. And it is faster than GeShi, even used in PHP with the system()function.

Artefact2
  • 7,516
  • 3
  • 30
  • 38
  • 2
    There is an bridge for Pygments in PHP [PHPygments](https://github.com/capy/PHPygments) and is well documented – Capy Apr 22 '13 at 21:19
  • That's good to know, it did not exist two years ago when I wrote this answer. – Artefact2 Apr 23 '13 at 20:05