Colorize code inside <code></code> [closed]
문제
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
제휴하지 않습니다 StackOverflow