【发布时间】:2012-12-06 10:32:16
【问题描述】:
我在博客上使用google-code-prettify 进行语法高亮显示。我的问题是我没有看到滚动条出现在我预先格式化的代码块周围,即使代码太宽而无法适应指定的宽度。我正在格式化代码块
<pre class="prettyprint lang-java prettyprinted" style=""> <code>public class MyVeryVeryLongClassname extends MyBaseClassWithAnEvenLongerName implements AnInterface, AnotherInterface, YetAnotherInterface { </code></pre>
在我的博客上,滚动条从不出现,并且线条超出了帖子列的右边缘(例如,看看this post),使它看起来很丑。 StackOverflow 也显示为:
public class MyVeryVeryLongClassname extends MyBaseClassWithAnEvenLongerName implements AnInterface, AnotherInterface, YetAnotherInterface {
我使用 Firebug 来研究 stackoverflow 是如何做到这一点的,但我没有发现任何与我正在做的不同的事情。我正在链接到与 SO 使用的相同的 JS 文件(在他们自己的 CDN 上)。我也在使用相同的样式。
那么,我需要怎么做才能将滚动条添加到预先格式化的代码块中?
【问题讨论】:
标签: javascript scrollbar pretty-print