The above block of code demonstrates an in-browser, syntax-highlighting, auto-indenting JavaScript editor. Use ctrl-i or ctrl-space (depending on which one your browser interferes with) to re-indent the current line. Known issues are...
syntax highlighting of code snippets in a web page A Javascript module and CSS file that allows syntax highlighting of source code snippets in an html page.