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

    I'm working on a MODX tutorial website and i would like to put MODX, HTML, CSS, Javascript tag inside content tab.
    <div class="makeIt">[[$myChunk]]</div>

    I've seen SyntaxHighlighter 1.0.1-pl from bobray but can't make it work with MODX tag.

    Is there any solution to do it ?

    This question has been answered by BobRay. See the first response.

      • 36926
      • 701 Posts
      You could use the entity number for example:

      [[
      ]]

      Maybe use a plugin onWebPagePreRender to replace the code with the correct entity.

      Alternatively you could use modmore's premium extra content blocks as it has a code input.
      https://www.modmore.com/contentblocks/documentation/input-types/#jump_code
      https://www.modmore.com/contentblocks/tips-tricks/displaying-code/

      EDIT: Seems as if the entity number is getting converted in the forum post, so you can see them here:
      http://www.freeformatter.com/html-entities.html

      Quote from: Steeve at Jul 14, 2016, 09:15 AM
      Hi,

      I'm working on a MODX tutorial website and i would like to put MODX, HTML, CSS, Javascript tag inside content tab.
      <div class="makeIt">[[$myChunk]]</div>

      I've seen SyntaxHighlighter 1.0.1-pl from bobray but can't make it work with MODX tag.

      Is there any solution to do it ?
        • 28432
        • 372 Posts
        Entities are replaced by tinymce editor.

        I found this post http://forums.modx.com/index.php?action=thread&thread=52863&i=1 but the :tag output filter removes html tag.
        Then in this article i found this http://modx360.com/blog/2010/02/12/prevent-parsing-modx-tags/ and it work for me smiley

        Thanks for reply !

        • discuss.answer
          • 3749
          • 24,544 Posts
          I use the SyntaxHighlighter plugin with MODX tags all the time, but maybe it works for me because I also use FixedPre:


          <pre class="brush: html; toolbar: false;"><fixedpre>
          [[!SomeTag]]
          </fixedpre></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
            • 28432
            • 372 Posts
            Quote from: BobRay at Jul 15, 2016, 04:10 AM
            I use the SyntaxHighlighter plugin with MODX tags all the time, but maybe it works for me because I also use FixedPre:


            <pre class="brush: html; toolbar: false;"><fixedpre>
            [[!SomeTag]]
            </fixedpre></pre>

            I just have a try with fixedpre tag but without success.
              • 3749
              • 24,544 Posts
              Do you have the FixedPre extra installed and enabled (and 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
                • 42562
                • 1,145 Posts
                https://github.com/donShakespeare/twPreCodeManager
                My TinyMCE plugin has all this solved for the most part.
                In the next release, just type in your MODX tags like a boss, the plugin will skillfully swap it to [*[modx_contet_etc]]
                This swapping also occurs when you load an existing MODX resource. All instances of [[$myChunk]] will be smoothly transformed to [*[$myChunk]] and saved as such.

                MODX will never parse it. TinyMCE can't meddle with it! Win win win.

                What do your visitors see? it's up to you.
                To get rid of the asterisk cosmetically, create a one-line snippet output modifier ...
                return str_replace('[*[', '[[', $content);
                [[*content:killAster]]

                This output modifier feature will be the default behaviour of TinymceWrapperMarkdown snippet.

                This works perfectly for inline CODE and block PRE. Enjoy!

                Now we need to go ask TinyMCE developers to release the square bracket from the default entity decoding - at least for MODX users
                  TinymceWrapper: Complete back/frontend content solution.
                  Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                  5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                  • 28432
                  • 372 Posts
                  Quote from: BobRay at Jul 15, 2016, 05:42 PM
                  Do you have the FixedPre extra installed and enabled (and SyntaxHighlighter)?

                  Yes! FixedPre installed and enabled. SyntaxHighlighter too !
                  But the problem is TinyMCE ! Every time i put fixedpre HTML tag into the TinyMCE HTML box it put it out when i make update.

                  Witch rich text editor are you using ?
                    • 28432
                    • 372 Posts
                    Thanks for reply donshakespeare !

                    When you say "My TinyMCE plugin" did you mean TinyMCE Wrapper ?
                    If yes i can't make it work on my installation. I'm on MODX Revolution 2.3.5-pl (traditional).
                    After uninstall TinyMCE and installed TinyMCE Wrapper there is no more Rich Text Editor into the resource page. I've check if the extra is activate and it is.
                      • 28432
                      • 372 Posts
                      Quote from: Steeve at Jul 20, 2016, 01:29 PM
                      Thanks for reply donshakespeare !

                      When you say "My TinyMCE plugin" did you mean TinyMCE Wrapper ?
                      If yes i can't make it work on my installation. I'm on MODX Revolution 2.3.5-pl (traditional).
                      After uninstall TinyMCE and installed TinyMCE Wrapper there is no more Rich Text Editor into the resource page. I've check if the extra is activate and it is.

                      FixedPre extra was in conflict with TinyMCE Wrapper. After uninstalled FixedPre i got two errors :
                      - tinymce.min.js:11 Uncaught TypeError: Cannot read property 'body' of undefined (when i inspected the code with Chrome)
                      - "/home/tutocms/core_current/components/imageplus/elements/tv/output/" in the manager and it partially work (image1.jpg) [ed. note: Steeve last edited this post 7 years, 10 months ago.]