Support » Plugin: SyntaxHighlighter Evolved » [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)
  • 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 Author Alex Mills (Viper007Bond)


    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?

    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 Author Alex Mills (Viper007Bond)


    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.

    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 :

    Plugin Author Alex Mills (Viper007Bond)


    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.

    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 Author Alex Mills (Viper007Bond)


    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.