Title: [Plugin: SyntaxHighlighter Evolved] HTML validation fails
Last modified: August 19, 2016

---

# [Plugin: SyntaxHighlighter Evolved] HTML validation fails

 *  [AlphaK](https://wordpress.org/support/users/alphak/)
 * (@alphak)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/)
 * I am using plugin version 3.0.1.
    HTML validation fails because of the tag <meta
   id=”syntaxhighlighteranchor” […] />
 * Validator says that there is no attribute “id”.
 * The plugin itself works, but having this part of code modified would allow to
   validate the code.
 * Best regards

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [AlphaK](https://wordpress.org/support/users/alphak/)
 * (@alphak)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774639)
 * Well, some more info.
    Validation is correct with doctypes XHTML 1.0 Transitional
   but not with doctypes XHTML 1.1. So basically validation will have a different
   result depending on the theme used.
 * I don’t know if WordPress recommends to use a particular doctype in themes. The
   validation problem occurs with the iNove one.
 * Maybe it could be possible to have that tag validated against both doctypes…
 *  Plugin Contributor [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774718)
 * Grr. I guess I’ll need to use some other type of anchor.
 * What do you think is the best element to use inside of `<head>` that accepts 
   an ID?
 *  Thread Starter [AlphaK](https://wordpress.org/support/users/alphak/)
 * (@alphak)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774729)
 * I searched the whole XHTML 1.1 DTD and unfortunately, from my understanding there
   is no child tag of the <head> element that accepts the attribute “id” 🙁
 *  Plugin Contributor [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774775)
 * What about `class` then?
 * Basically I need an anchor element to use that is after `style.css` that my Javascript
   can look for an inject stylesheets after.
 *  Thread Starter [AlphaK](https://wordpress.org/support/users/alphak/)
 * (@alphak)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774811)
 * OK. If my understanding is correct, you use it in the following code :
    `document.
   getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("
   syntaxhighlighteranchor") );`
 * Then why not adding your stylesheets at the end of the head element ? Then there
   is no need for an id nor a class. This code might do the trick :
    `document.getElementsByTagName("
   head")[0].appendChild(corecss);`
 *  Plugin Contributor [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774813)
 * That’s the exact code I had been using. The problem with that is that it then
   becomes impossible for people to override the plugin’s CSS unless they create
   a custom plugin theme or edit the plugin’s files.
 * The advantage of the current set up is someone can hook into `wp_head` at priority
   20 or whatever and then output a stylesheet with some `!important` rules.
 *  Thread Starter [AlphaK](https://wordpress.org/support/users/alphak/)
 * (@alphak)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774814)
 * Huge history as I can see.
 * Again in XHTML 1.1 none of the mandatory child element of the `<head>` tag support
   a `class` attribute.
 * Then I may suggest 2 workarounds :
 * First one : to cycle manually through meta tags until the one which attribute`
   name` equals `syntaxhighlighter-version` is found. There we can insert `corecss`
   and `themecss` just before.
 * Second one : to do the same but using WordPress’s internal jQuery to catch the
   correct tag using a direct selector, that would look like : `$('meta[@name="syntaxhighlighter-
   version"]')`
 * Both solutions may imply a loss of performance during the script load, but negligible
   I assume.
 *  Plugin Contributor [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774815)
 * I don’t want to load up jQuery just to do that, as much as I love jQuery. 🙂
 * I like the first solution. My crappy Javascripts skills and I will give that 
   a go. Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘[Plugin: SyntaxHighlighter Evolved] HTML validation fails’ is closed 
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/syntaxhighlighter_ffffff.svg)
 * [SyntaxHighlighter Evolved](https://wordpress.org/plugins/syntaxhighlighter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/syntaxhighlighter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/syntaxhighlighter/)
 * [Active Topics](https://wordpress.org/support/plugin/syntaxhighlighter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/syntaxhighlighter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/syntaxhighlighter/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-syntaxhighlighter-evolved-html-validation-fails/#post-1774815)
 * Status: not resolved