You can use Pygments, which is written in python, to generate an HTML representation of the source code, which can then be presented in a Web View.
(Note, as reflected in comment below - this answer was to the original question, which did not mention editable text.)