问题
I'm looking for a set of CSS/JS code that would let me create special text areas with properly formatted and displayed code samples similar to this.
Would you please suggest a open source solution for this.
回答1:
This StackOverflow question may be of help. You might also want to check out code-highlighter. It highlights JavaScript, CSS, and HTML by default, but doesn't have line numbers. Here is an interesting solution that does have line numbers.
Also, google-code-prettify looks like a fairly mature and has pretty good support for a number of languages.
回答2:
SyntaxHighlighter version 2.1.364 (October 15 2009) http://alexgorbatchev.com
http://builtbywill.com/code/booklet/examples/size for a demo
来源:https://stackoverflow.com/questions/4688484/css-js-to-format-and-display-code-samples-on-a-website