Over at Rails Authority I use a great client-side syntax highlighter called SyntaxHighlighter to make code examples look nice, but it doesn’t supportValid XHTML , so I enhanced it to handle an XHTML-compatible style, e.g.:
(Inspired by Ernest's post, linked above.)
To make this work, I made three changes to the shCore.js file (all within the HighlightAll function):
In FindTagsByName, change line 618 that says:
... to:
Down a few lines at line 627, insert another FindByTags call for 'code':</p>
Further down, at line ~ 657 insert this right before options = options.split(':');:</p>
This should be backward-compatible with the existing pre and textarea methods.