We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/680">GeSHI Syntax highlighter 0.1-beta1</a> by lossendae.

    Brief Description:
    Usage:

    The plugin will search for <pre></pre> or <pre class="{my code nme (php, js, html, xml...)}"></pre> before the content being parsed and return the text highligted and escaped.



    MODx Tags will be converted to their html entities as well.



    However, for listed content like with getResources or Ditto, the content will not be highlighted since it was not retreived.



    Therefore, there is an additional snippet which do basicallly the same thing as the Plugin but for parsed content.



    Example with getResources [[+content]] placeholder:



    [[!GeSHI? &highlight=`[[+content]]`]]



    GeSHI Snippet is ouput filter ready, so you can also do it like that:



    [[+content:GeSHI]]



    Note: GeSHI does not use the <code> tag.



      • 3749
      • 24,544 Posts
      I installed this through Package Manager. The snippet was installed but no plugin.

      Also, this works (using the snippet):

      <pre>
      <?php
      echo "hello";
      return "goodbye";
      ?>
      [[SnippetName? &param1=`hello` &param2=`goodbye`]]
      </pre>


      But this doesn’t:

      <pre>
      <?php
      echo "hello";
      return "goodbye";
      ?>
      </pre>
      
      <p>Some text</p>
      
      <pre>
      [[SnippetName? &param1=`hello` &param2=`goodbye`]]
      </pre>


      It looks like when there are multiple <pre> tags, it entifies its own entities. So you get this in the rendered page:

      [[SnippetName? &param1=`hello` &param2=`goodbye`]&#093
        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
        • 17499 ☆ A M B ☆
        • 872 Posts
        I’ll look into the plugin issue.

        The second example should work if you precise the html class (<pre class="html">). I will add it to the package description.

        Thanks for the feedback.
          • 3749
          • 24,544 Posts
          Quote from: lossendae at May 24, 2010, 06:01 PM

          I’ll look into the plugin issue.

          The second example should work if you precise the html class (<pre class="html">). I will add it to the package description.

          Thanks for the feedback.


          Yes it does! Thanks lossendae. This is a great contribution! grin
            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
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            Is this still supported in RC2?

            It’s not appearing in the Package Manager using RC2.


            I’ve installed this manually, and getting some funky results :p

            On every refresh it is escaping characters it already escaped the previous time.. and it seems to be appending more spans to highlight the originally added spans.

            Example (browser view):

            identity = $_POST['openid_identifier'];
            identity <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st_h">'openid_identifier'</span><span class="br0">]</span><span class="sy0">;</span>


            Same example (source view):
            <pre class="php">identity <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st_h">'openid_identifier'</span><span class="br0">]</span><span class="sy0">;</span>
            
            <pre class="php">identity <span class="sy0"><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st0">"sy0"</span><span class="sy0">>=</</span>span<span class="sy0">></span> <span class="sy0"><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st0">"re0"</span><span class="sy0">></span><span class="re0">$_POST</span><span class="sy0"></</span>span<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st0">"br0"</span><span class="sy0">>&</span><span class="co2">#91;</span><span class="st_h">'openid_identifier'</span><span class="br0">&#93;</span><span class="sy0">;</span>


            So.. yeah tongue
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 3749
              • 24,544 Posts
              Quote from: Mark at Jul 04, 2010, 07:28 PM

              Is this still supported in RC2?

              It’s not appearing in the Package Manager using RC2.

              I think it may have been replaced by CodeMirror.
                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
                • 17499 ☆ A M B ☆
                • 872 Posts
                I did not try it with RC2 yet.

                There are issues that needs to be solved, i’ll work on it tomorrow.

                CodeMirror is a live code editor, not the same as Geshi who only highlight not editable code.
                  • 17499 ☆ A M B ☆
                  • 872 Posts
                  Hello BobRay and Mark,

                  Do you both use an RTE to write your articles ?

                  I’ve been able to reproduce your double chars escaping issues only with tinyMCE activated and pre’s that don’t have a class attached to it.

                  With the default textarea, the code is no longer escaped before saving the article in the database.

                  Can someone confirm this with their own articles ?
                    • 3749
                    • 24,544 Posts
                    Quote from: lossendae at Aug 03, 2010, 06:50 PM

                    Hello BobRay and Mark,

                    Do you both use an RTE to write your articles ?

                    Never. smiley
                      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
                      • 17499 ☆ A M B ☆
                      • 872 Posts
                      :D

                      Can you verify if the record in your database is escaped or not (it should not be)?