Using MACROS in CKEditor 5

May 28, 2026

Selecting MACROS

CKEditor 5 supports MACROS out of the box, and no special effort, such as plugin installation, is required. Simply install CKEditor 5, create RichText content, and enter ## in the editor to see the available suggestions. The list of suggestions will change as you modify the MACROS text.

Macros Suggestions List

Adding New MACROS

To add new MACROS to CKEditor 5, simply add a Groovy script with the desired functionality to a module under <your_module>/src/main/resources/WEB-INF/macros/testmacros.groovy (example: username.groovy), deploy the module, and enable it on your site. Then, when you type ##tes, you should see your MACROS in the suggestions. Simply select one, and when your RichText is rendered, it will replace the MACROS placeholder with whatever your Groovy file outputs.

Macros Suggestions List

You can learn more about MACROS by visiting this link.

Excluding MACROS

You may want to exclude certain macros from the list of suggestions. To do so, edit org.jahia.modules.richtextCKEditor5.cfg and update the excludeMacros list:

excludeMacros[0]=sessionid

How MACROS Is Integrated

The MACROS functionality is made available with the help of the mentions plugin provided by CKEditor. The following configuration is used to set it up:

mention: {
    feeds: [
        {
            marker: '##',
            feed: getFeedItems,
            itemRenderer: customItemRenderer
        }
    ]
}

Note that this means the marker ## is reserved and should not be used with any other feed you might add to this configuration.