我刚开始在Alex Gorbatchev's SyntaxHighlighter 3.0.83上使用my website,每these fantastic instructions here。然后,我globally set a max-height
of 1024 pixels以保持长代码块不会过高,但现在我想实现一个" wrap-text"或"换行"类型功能可在查看时自动换行长行。这可能吗?我相信它曾经作为一个功能提供,但不再是(我认为)。
例如,这里是来自this temporary internet page的代码块的屏幕截图。注意注释如何在可见窗口的(在右侧)之外延伸。我希望SyntaxHighlighter强制换行而不是使用水平滚动条。
如果您不熟悉SyntaxHighlighter:,因为SyntaxHighlighter需要执行此操作,所以格式化为一对<pre>
</pre>
标记,例如:<pre> code goes here </pre>
,您在上面的屏幕截图中看到的漂亮语法高亮的C ++源代码的HTML就是这样:
<pre class="brush:cpp">
//I am a long line of C++ source code; I just keep going on and on and on forever to the end of my days because my creator used line-wrapping in his text editor to write me and sometimes he likes long comments.
int myFunc()
{
//do something
return 1;
}
</pre>
根据我上面链接的Blogger,在您的网站(例如installation instructions)中加上一点点,然后再加上它。
如何使SyntaxHighlighter换行显示它的内容?