If you take a look at the Redactor JS demo and click on the button to show the HTML source code of the displayed content...
...you will notice that the code is properly indented:
Most rich text editors or wysiwyg editors typically display code in a single line without any indentation.
I am curious about how this is achieved. Any thoughts?
EDIT :
Let me clarify my question. I'm wondering how that specific text is formatted beautifully from a technical standpoint. I am aware of jsbeautifier and similar tools that wrap each line of code for styling purposes. However, if you actually visit the link and view the source, you will see a neatly intended textarea with no intrusive CSS applied.
HTML
<textarea id="redactor" style="display: block; height: 797px;" dir="ltr"><h2>The Last of The Mohicans</h2> <p><em>by James Fenimore Cooper</em></p> <p>Winding its way among countless islands, and imbedded in mountains, the "holy lake" extended a dozen leagues still further to the south. With the high plain that there interposed itself to the further passage of the water, commenced a portage of as many miles, which conducted the adventurer to the banks of the Hudson, at a point where, with the usual obstructions of the rapids, or rifts, as they were then termed in the language of the country, the river became navigable to the tide.</p> <p><img src="/img/redactor-image.jpg" width="1400" height="582"></p> <p>"Come," he said, with a good-humored smile; "the buck that will take to the water must be headed, and not followed."</p> <p>The route taken by Hawkeye lay across those sandy plains, relived by occasional valleys and swells of land, which had been traversed by their party on the morning of the same day, with the baffled Magua for their guide. The sun had now fallen low toward the distant mountains; and as their journey lay through the interminable forest, the heat was no longer oppressive. Their progress, in consequence, was proportionate; and long before the twilight gathered about them, they had made good many toilsome miles on their return.</p> </textarea>
The above code snippet is well-intended, and I am curious to know why/how it is done.