Right now, the code within the editor div is being parsed as HTML (most of it invalid in this context), and thus, only the text parts are being shown. To prevent this, you'll have to escape all the HTML reserved characters. You can use an online encoder like this one, which will result in code like the following, which you can then copy-paste into the editor div:
<div id="editor">
<!DOCTYPE html>
<html>
<head>
...
If you have a look at the source code for the Ace embedding guide (hint: search for the second occurrence of the word DOCTYPE), you'll see the same thing.