tags excluding the current indentation level of thetag in the document?
I\'m trying to display my code on a website but I\'m having problems preserving the whitespace indentation correctly.
For instance given the following snippet:
This can be done in four lines of JavaScript:
var pre= document.querySelector('pre');
//insert a span in front of the first letter. (the span will automatically close.)
pre.innerHTML= pre.textContent.replace(/(\w)/, '$1');
//get the new span's left offset:
var left= pre.querySelector('span').getClientRects()[0].left;
//move the code to the left, taking into account the body's margin:
pre.style.marginLeft= (-left + pre.getClientRects()[0].left)+'px';
Here is my code:
def some_funtion
return 'Hello, World!'
end