I am using google code prettify. After a page renders, I decided to check how <code>
and <pre>
tags and their contents were manipulated.
But in view source, I found no changes were made (in contrast to online syntax highlighters, which generate css style code with code text).
So, how/where is info about keywords, variable, comments, etc (from code tag text) stored and manipulated?
1
In “view source”, you see the original source downloaded. What you’d get with wget
or lynx
for example.
The end result you see has been manipulated by Google Code Prettify’s JavaScript code, and can be seen with tools such as Chrome Dev Tools or Firefox Dev Tools.
As Servy said, the DOM is riddled with <span>
tags and the likes.
1