Im using the js SyntaxHighlighter 3.0.83 from http://alexgorbatchev.com/SyntaxHighlighter/
I've been googling the entire world now it seem but cant really find how to enable line breaks. Instad i get a horizontal scrollbar, which is good sometimes but not in my scenario.
In example
Anyone out there who know the way around this?
I don't actually use SyntaxHighlight, but it seems to be possible to attach an white-space: pre-wrap
CSS style to the <pre>
or <script>
tag that SyntaxHighlight uses.
HTML (using <pre>
):
<pre class="brush: js" class="syntaxhighlight">
/**
* SyntaxHighlighter
*/
function foo()
{
if (counter <= 10)
return;
// it works!
}
</pre>
HTML (using <script>
):
<script type="syntaxhighlighter" class="syntaxhighlight brush: js"><![CDATA[
/**
* SyntaxHighlighter
*/
function foo()
{
if (counter <= 10)
return;
// it works!
}
]]></script>
CSS:
.syntaxhighlight {
white-space: pre-wrap;
}