2011-01-06 94 views

回答

1

可以使用Pygments来做这是蟒蛇显示数百o一个工具。 f不同的语言http://pygments.org/,所以也红宝石。

7

有很多这样的工具堆栈溢出使用google-code-prettify如果你喜欢的代码格式张贴在这里,你可能想使用Ruby示例:。

<pre class="prettyprint lang-ruby"> 
def sum(n) 
    result = 0 
    i = 1 
    while i <= n 
     result += i 
     i += 1 
    end 
    return result 
end 
</pre> 

结果将是这样的:

def sum(n) 
    result = 0 
    i = 1 
    while i <= n 
     result += i 
     i += 1 
    end 
    return result 
end 
+0

我没有在其中看到任何“lang-ruby”:http://code.google.com/p/google-code-prettify/source/browse/trunk/src 。我错过了什么? – Eduardo 2014-01-22 22:34:16

0

您链接到的页面是一个似乎在使用wp-syntax wordpress plugin的WordPress博客。如果您搜索“语法突出显示器”或“语法突出显示”,您可以找到适用于您的网页的内容。

相关问题