1

I'd like to embed code from my SVN repository into my website, using PHP. The SVN has public anonymous access, so the PHP code should be fine reading it.

The code on said SVN is java, and so far I've had no luck finding a syntax-highlighter to make the code more readable. Ideally I'd like one that uses CSS classes so that I can change the colors to match the look of the website.

Could someone point me to a PHP library that highlights Java code?

2 Answers 2

2

Have you considered GeSHi? It supports a lot of languages including Java. You have to enable classes to use CSS classes.

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

Comments

0

Redmine or Trac can be connected to your SVN repo and will allow you to browse the contents with syntax highlighting. Both packages can be themed, and there are plenty of web sites that base the entire site on them.

GeSHi as recommended by Yacoby is also another option. I use that on my Drupal-based web site and it works quite well. It doesn't connect directly to a SVN repo though - for that you'd need a separate library. See http://www.petercarrero.com/content/2009/10/23/getting-php-bindings-subversion for an excellent blog entry that explains how to do this.

1 Comment

Like I said, it's a public (ie read-only) SVN, so I can just use file_get_contents() to get the file. Beanstalkapp.com already does syntax highlighting for logged-in users.

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.