We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If you use CKEditor, it has a configuration option to ignore specified code. It treats the code as if it were an HTML comment. For example, in the modx.config.js file you can put
    CKEDITOR.config.protectedSource.push( /\[\[(.*?)\]\]/g );
    CKEDITOR.config.protectedSource.push( /\[!(.*?)!\]/g );
    CKEDITOR.config.protectedSource.push( /\[~(.*?)~\]/g );
    CKEDITOR.config.protectedSource.push( /\[\((.*?)\)\]/g );
    CKEDITOR.config.protectedSource.push( /\[\+(.*?)\+\]/g );
    CKEDITOR.config.protectedSource.push( /\[\^(.*?)\^\]/g );
    CKEDITOR.config.protectedSource.push( /\[\*(.*?)\*\]/g );
    CKEDITOR.config.protectedSource.push( /{{(.*?)}}/g );
    

    This will protect all of the MODx tags. They will not be meddled with, and they will not be displayed in the rich text editor's content. This works best if the tags are inserted into the content in Source mode.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 39194
      • 149 Posts
      Is it possible to protect MODx Revo tags? These can be nested, so I don't know whether it is possible to use RegExp for the matching.