We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    Is it possible to place [[Wayfinder]] into the TinyMCE contentfield but don't let modx do anything with this just show and not process it?

    (So I can use syntaxhighlighter on front-end)

    Just like this forum I can do below without loading the wayfinder navigation or chunkcode:

    [[Wayfinder]] {{mychunk}}
    [ed. note: fourroses666 last edited this post 12 years, 10 months ago.]
      Evolution user, I like the back-end speed and simplicity smiley
      • 22840
      • 1,572 Posts
      Is this for displaying code on the front end, like a tutorial ?

      https://forums.modx.com/thread/29414/code-block-for-revolution

      EDIT:

      Sorry thats for revo sad
        • 9995
        • 1,613 Posts
        yea like a tut, seen that post, still looking for a solution
          Evolution user, I like the back-end speed and simplicity smiley
          • 13428 ☆ A M B ☆
          • 1,031 Posts
            • 9995
            • 1,613 Posts
            Quote from: Jako at Nov 08, 2013, 05:11 AM
            http://modx.com/extras/package/notparsemodxtags

            Thanks will try that smiley
              Evolution user, I like the back-end speed and simplicity smiley
              • 9995
              • 1,613 Posts
              It works for <pre> but I use syntaxhighlighter and need a different <pre> class.

              <pre class="brush php"> and <pre class="brush css"> and <pre class="brush xml">


              The plugin needs to be modified:

              function replace_modxtags($matches){
                  global $modx;
                  $code_entities_match = array('[', ']','{', '}');
                  $code_entities_replace = array(
                                      '<span class="bracket">[</span>',
                                      '<span class="bracket">]</span>',
                                      '<span class="bracket">{</span>',
                                      '<span class="bracket">}</span>',
                                  );
                  $code = str_replace($code_entities_match,$code_entities_replace,$matches[1]);
                  return '<pre>'.$code.'</pre>';
              
              }
              
              $modx->documentObject['content']=preg_replace_callback("#<pre>(.*?)</pre>#s", "replace_modxtags", $modx->documentObject['content']);
              



              I tried to add:
              return '<pre class="brush php">'.$code.'</pre>';



              Any idea?
                Evolution user, I like the back-end speed and simplicity smiley
                • 13428 ☆ A M B ☆
                • 1,031 Posts
                If you use only the pre tag in in content this plugin should work. Otherwise you have to change the regex in line 15 to:

                $modx->documentObject['content']=preg_replace_callback("#<pre[^>*]>(.*?)</pre>#s", "replace_modxtags", $modx->documentObject['content']);
                  • 9995
                  • 1,613 Posts
                  I made a typo, its needs to be class="brush: php...

                  But still can't get it to work.
                  <pre> works with the old code but as soon as I use <pre class="brush: php"> the modx call is blank.
                  when I use your line of code the <pre> and <pre class="brush: php"> don't work.
                  it wants to parse the modx tag [[Ditto?..

                  maybe these two are conflicting each other. (syntax highlighter and notparsemodxtags).
                    Evolution user, I like the back-end speed and simplicity smiley
                    • 13428 ☆ A M B ☆
                    • 1,031 Posts
                    Is syntax highlighter a plugin too?
                      • 9995
                      • 1,613 Posts
                      I use Syntax Hightlighter which isn't a snippet/plugin at all.
                      Thought it was a plugin but isn't (it was installed by a colleague)

                      https://github.com/alexgorbatchev/SyntaxHighlighter

                        Evolution user, I like the back-end speed and simplicity smiley