We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18367
    • 834 Posts
    Hi,

    I'm trying to get Syntaxhighlighter to work on Revo without much luck. I read the tute on Bob's Guides and have followed his instructions as best I understand them.

    I just want to use it as a snippet.
    According to the guide if I place
    [[SyntaxHighlighter?]]
    at the top of the content and <pre> around the code it should work. As
    If no brushes are specified in the tag, the default brushes (JScript,Xml,Php,Css,Plain) are loaded.

    Anyway I don't get much other than a page title and with no highlighting.

    Am I missing something?

    Here's the code I'm trying to highlight:

    <pre><!-- Update your html tag to include the itemscope and itemtype attributes. --> <!-- Place this data between the <head> tags of your website --> Page Title. Maximum length 60-70 characters <!-- Google Authorship and Publisher Markup --> <!-- Schema.org mark-up for Google+ --> <!-- Twitter Card data --> <!-- Twitter summary card with large image must be at least 280x150px --> <!-- Open Graph data --></pre>


    Thanks
      Content Creator and Copywriter
      • 3749
      • 24,544 Posts
      The brushes are loaded, but you haven't asked for any of them in your pre tag.

      Try this instead:

      [[!SyntaxHighlighter? &brushes=`html`]]
      
      <pre class="brush: html"><!-- Update your html tag to include the itemscope and itemtype attributes. --> <!-- Place this data between the <head> tags of your website --> Page Title. Maximum length 60-70 characters <!-- Google Authorship and Publisher Markup --> <!-- Schema.org mark-up for Google+ --> <!-- Twitter Card data --> <!-- Twitter summary card with large image must be at least 280x150px --> <!-- Open Graph data --></pre>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 18367
        • 834 Posts
        I get an error message saying it can't find brush for .html
          Content Creator and Copywriter
          • 3749
          • 24,544 Posts
          Did you try it with just

          [[!SyntaxHighlighter]]


          ?
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 18367
            • 834 Posts
            Ah,

            it's a beautiful thing.

            Thanks
              Content Creator and Copywriter
              • 3749
              • 24,544 Posts
              There's something goofy about the way Syntaxhighlighter loads the brushes. It might have worked to use &brushes=`Xml` or &brushes=`htm` or something else. They are supposed to all be set as aliases of each other, but I remember having a similar problem. I've been meaning to look into it but haven't had the time.

              I use the plugin at Bob's Guides. I just checked and the brushes property is set to: JScript,Php,Css,Plain,Xml
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 18367
                • 834 Posts
                Actually I was trying all those variations with no luck.

                It was definitely the change to
                [[!SyntaxHighlighter]]
                that made the difference.

                Once I did that they all worked.

                Thanks Again.
                  Content Creator and Copywriter
                  • 3749
                  • 24,544 Posts
                  Thanks for reporting that. I've updated the docs.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 18367
                    • 834 Posts
                    Bonus Question

                    I realise this next one may be outside the scope of this thread but I'll put it out there anyway.

                    The article I'm using this snippet on is about meta data and specifically opengraph data.

                    While the page now works, when I run it thru Facebook's Debugger or Google's Rich Data Tester, they both read the code in the highlighted section, and as such they can't deal with two lots of meta data real well.

                    IE The real meta data and the meta data in the highlighted section of the article.

                    Does anyone know how to stop these tools from reading the code in the highlighted sections?

                    Thanks



                      Content Creator and Copywriter
                      • 3749
                      • 24,544 Posts
                      You could try wrapping it with CDATA, but I think you'd have to remove the SyntaxHighlighter tag to make it work:

                      <![CDATA[

                      /* your stuff here */

                      ]]>
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting