Code mark-up and highlighting utilities
Code highlight mark-up service:
- Input: html, xml, JavaScript or css code
- Output: html code with keywords and other syntactical features of the input marked-up, and markup characters escaped.
- JavaScript and css within html code are also highlighted.
- Should work in any modern browser. And in Internet Explorer 5/6.
Source code lister/highlighter:
- You feed it one or more urls, it lists the file(s) it finds there with the code highlighted.
- Is known to work in Mozilla/Firefox and Internet Explorer. Should work in any browser that has support for XMLHttpRequest. In other browsers it provides a polite error message.
In-page dynamic code highlighter:
- You put the script and stylesheets in your page, and it highlights any 'pre' elements it finds with the 'class' attribute set to the name of a language it can parse.
- Make sure the class attribute is also the one(s) recognised by the code highlighting stylesheet.
- If you can tell me why it doesn't work with Internet Explorer, that would be nice, thank-you.
Acknowledgement
The idea for the code driving these pages is derived from work by Dean Edwards. I wanted his highlighter to do something it wasn’t designed for, and I didn’t know JavaScript well enough to adapt it, so I wrote my own parser/highlighter as a learning exercise.
License
The code is licensed under a Creative Commons License. (See copyright link below.)