A syntax-higlighting JavaScript editor in JavaScript
marijn.haverbeke.nl
marijn.haverbeke.nl
Hey Marijn I didn't know the code had been previously submitted. I added your article because I've been looking to hack up a simple Javascript console editor to work with.
editing Javascript in Firebug is okay for simple expressions
useless for anything above 3 lines
Coding in the browser allows the REPL [0] time to be reduced and you get instant feedback. So this lead me to your article. What I intend to do is try to re-create pythons idle shell [2] allowing you to type in syntax (highlighted) then press enter, eval the code on the next line. Reading your article helps me a lot in solving this. I re-created the demo in about 5min last night. One problem I do have is entering text then hitting newline. Artifacts are left on-screen and the gutter spacing is odd. I'll see if YUI Dom object can solve the placement problem.
I do like the style of syntaxhighlighter. [3] Did you ever think of adding line numbers?
[0] http://en.wikipedia.org/wiki/REPL
[1] Demo code ~ http://marijn.haverbeke.nl/codemirror/
Let me guess, you?
I remember seeing a 3D JS/DOM 1st person shooter and a raytracer in JS, wonderful intelectual excercises. Probably not products.
Wrong.
If you read the article carefully, you will see the code was used to produce a rather nice interactive digital book, *"Eloquent JavaScript: An opinionated guide to programming" ~ http://eloquentjavascript.net/chapter1.html