#Marking up Code
In reviewing syntax highlighters, I have observed that there are as many different ways to mark up a code fragment in HTML as there are highlighting tools. In other words, every tool seems to define a different syntax. Some use pre
tags, some use 'code' tags, some use both, and then there are those that use other elements like div
tags.
The most obvious problem with this is that if you want to switch to a different tool, you need to change all your old HTML documents to use the new syntax; which could be a real time suck. Sure the process could be automated, but writing a bug-free script could become just as painful as making the changes manually.
Another, perhaps less obvious issue is the semantics of the markup used. Does the markup accurately convey what the content actually is? For example, many people use pre
tags around code. Of course, the pre
element is specifically for "preformatted text" which code often is. However, some have argued that preformatted text is presentatio