문제

I'm looking for a open source PHP script to colorize the code inside

<code></code> 

or

[code][/code] tags.

Thanks

도움이 되었습니까?

해결책

You could also try a clientside/javascript highlighter: Google Code Prettify

  • Supports all C-like, Bash-like, and XML-like languages.

(This is the one used on stackoverflow.com/ and code.google.com/)

다른 팁

Assuming you want something other than the built-in syntax highlighter, GeSHi looks like it might fit your requirements:

GeSHi started as an idea to create a generic syntax highlighter for the phpBB forum system, but has been generalised to this project. GeSHi aims to be a simple but powerful highlighting class, with the following goals:

  • Support for a wide range of popular languages
  • Easy to add a new language for highlighting
  • Highly customisable output formats

PHP has some built in functions for this purpose. Check if highlight_string or highlight_file will work for you

http://www.php.net/highlight_file

http://www.php.net/highlight_string

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top