I am looking at this google prettify project: https://github.com/google/code-prettify
In the usage section it says to use it like so:
<pre class="prettyprint">class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded <a href="#voila2">tags</a>.
}</pre>
I am looking for a way to style all pre tags without having to add a class to the pre tag. Is there some way to do this with this library or another similar library? I am trying to syntax highlighting in the browser for Java/JavaScript etc.
This is a somewhat hacky solution, but looking at the (minified) code in that library,
prettyprintis used in the following section:and
It tests whether the
classNameof the iterated elements matches that regular expression. So, if you just remove those tests againstu, it should work without having to add a class to the<pre>s:It's now only testing if
w(/^(?:pre|code|xmp)$/i) matches thetagNameof the element.