2

I have a CSS parser thats printing out stylesheet to the browser like so:

$cssParser->parse( 'style.css' );
echo '<pre>'; print_r( $cssParser ); echo '</pre>';

Can I 'syntax highlight' the output CSS somehow?

Thanks

1
  • 2
    What does $cssParser->parse('style.css') do? Break the CSS into some kind of mapping of names to values? Commented Oct 12, 2009 at 5:49

2 Answers 2

6

If you want to code-highlight something using PHP, getting some HTML code as output, GeSHi - Generic Syntax Highlighter is a nice solution (used by many software, should I add), that supports lots of languages -- and CSS seems to be one of those.

If you want to try it without integrating it into your application first, there is a demo page available, btw.

Sign up to request clarification or add additional context in comments.

1 Comment

GeSHi was last updated in 2017 and does not work in PHP 8; but replacing the create_function call in line 4698 with a closure $callback_2 = function($matches) { return '[' . str_replace('|', '', $matches[1]) . ']';}; will make it work.
4

Hyperlight? (download from svn at http://code.google.com/p/hyperlight/source/browse/trunk/)

PHP syntax highlighting?

2 Comments

Tried, but there's nothing in the download section.
Damn, I really need to produce a release for the project. :-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.