CSS/JS在网站上格式化和显示代码示例 [英] CSS/JS to format and display code samples on a website
问题描述
我正在寻找一组CSS/JS代码,这些代码可以让我创建带有特殊格式和显示的代码示例的特殊文本区域,这些示例类似于
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.
推荐答案
此StackOverflow问题可能会有帮助.您可能还想查看代码突出.默认情况下,它突出显示JavaScript,CSS和HTML,但没有行号. 这是一个有趣的解决方案,它具有行号.
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.
google-code-prettify 看起来相当成熟并且对多种语言都有很好的支持.
Also, google-code-prettify looks like a fairly mature and has pretty good support for a number of languages.
这篇关于CSS/JS在网站上格式化和显示代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!