I have a <pre> & <code> tag which looks like:
<pre><code>somevar = array.join("-")
somevar.split("-")
puts "#{somevar} is cool yay!"
if somevar.nil?
puts 'it's nil!'
end
</code></pre>
How can I make it look like it’s correctly indented? It actually looks like:

and it should look like:

I tried jQuery’s ‘trim()’ function and ‘replace()’ with this RegEx:
/^\s*//\s*$//^\s+|\s+$/gi
But no way. How should I do it? Thanks!
Ensure the code in the HTML has no preceding whitespace on the newlines –
prewon’t collapse multiple whitespace.