It seems to me that whatever the backend of Canvas is, that all it needs to do is the equivalent of a PHP htmlspecialchars call when displaying the file.
This would make the grading of programming assignments infinitely easier.
Other options like view page source on the submission is not appropriate because PHP is generating dynamic code and that must be evaluated itself.
The annotation tools would be a godsend here.