Code is here http://jsfiddle.net/Ea7hd/1/
Basically my output needs to match the indentation of the html elements as they appear in the textarea.
The problem is that when I am looping through all the elements in the textarea I have no way of adding proper indentation because the I have no way of setting where one element is in relation to its parent.
You can use
<div>withpadding-left: http://jsfiddle.net/Ea7hd/5/.Identation, padding and margin are styles, so you should achieve them trough CSS, so you shouldn’t do it adding
.